I have an iOS app that uses GLKViewController and I set up the render buffer as follows:
inside
@interface RootViewController : GLKViewController<UIKeyInput>
- viewDidLoad {
[super viewDidLoad];
_context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
GLKView* view = (GLKView*)self.view;
view.context = _context;
view.drawableColorFormat = GLKViewDrawableColorFormatRGBA8888;
view.drawableDepthFormat = GLKViewDrawableDepthFormat24;
view.drawableStencilFormat = GLKViewDrawableStencilFormat8;
view.drawableMultisample = GLKViewDrawableMultisampleNone;
self.preferredFramesPerSecond = 60;
[EAGLContext setCurrentContext:_context];
}
However, when I call draw later:
glDrawElements(getGlPrimitiveType(ePrimType), numIndis, GL_UNSIGNED_SHORT, startIndis);
It results in black screen and upon Capture GPU Frame
, this error shows up:
Your app rendered with STENCIL_TEST enabled into a framebuffer without an attached stencil buffer.
Is there anything that I missed?
I remembered having the same problem before due to depth testing, and I fix it with the view.drawableDepthFormat = GLKViewDrawableDepthFormat24;
on viewDidLoad
I am not sure about stencil testing, Apple's documentation is either very minimal or very general with theories all around (i.e: pretty much useless).