Friday, January 10, 2014

opengl es 2.0 Renderbuffer problems

GLint iWidth = 0;
GLint iHeight = 0;

iWidth = self.frame.size.width;
iHeight = self.frame.size.height;
glRenderbufferStorage (GL_RENDERBUFFER, GL_RGBA8_OES, iWidth, iHeight);
/ / [_context RenderbufferStorage: GL_RENDERBUFFER fromDrawable: _eaglLayer];


Two lines in which the red color, with the above line, drawn content does not show up; with the following line that draw content can be displayed, we help you look, why ah?
Reply:
Obviously myself:
glRenderbufferStorage is to open up a memory (memory or memory that is not looking to find out answers?) as the current storage area RenderBuffer, but this is only in the memory, it did not follow the actual on-screen display in association;
The next sentence, fromDrawable: _eaglLayer That is using this _eaglLayer as RenderBuffer storage area, then draw something on RenderBuffer course displayed in this _eaglLayer again, and this layer is eventually displayed on the screen.
Reply:
Eventually put renderBuffer content displayed on the screen, always use the following phrase. At an off-screen rendering is generally used to do, the renderBuffer use as a background buffer.
Reply:
Thanks for the answer!
I just want to make off-screen rendering, then the results offscreen rendering to the screen, I do not know what to do?
 - (void) setupMemRenderBuffer {
glGenRenderbuffers (1, & _memRenderBuffer);
glBindRenderbuffer (GL_RENDERBUFFER, _memRenderBuffer);
GLint iWidth = 0;
GLint iHeight = 0;

iWidth = self.frame.size.width;
iHeight = self.frame.size.height;
glRenderbufferStorage (GL_RENDERBUFFER, GL_RGBA8_OES, iWidth, iHeight);
/ / [_context RenderbufferStorage: GL_RENDERBUFFER fromDrawable: _eaglLayer];
}

No comments:

Post a Comment