I have a problem rendering to a texture and offscreen OpenGLES from OpenGLES to iPhone.

(source: imagehost.org )

(source: imagehost.org )
The first image shows mahjong tiles rendered directly in CAEAGLLayer and thatβs right. The second shows tiles rendered into off-screen glCopyTexImage2D , copied to the texture using glCopyTexImage2D and textures rendered in CAEAGLLayer . Both use a white opaque quad for the background. I also tried rendering directly to the texture, but the effect was the same as behind the frame buffer frame.
My code for creating framebuffer:
GLuint framebuffer; glGenFramebuffersOES(1, &framebuffer); glBindFramebufferOES(GL_FRAMEBUFFER_OES, framebuffer); GLuint renderbuffer; glGenRenderbuffersOES(1, &renderbuffer); glBindRenderbufferOES(GL_RENDERBUFFER_OES, renderbuffer); glRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_RGB8_OES, 512, 512); glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, renderbuffer);
I draw all the tiles from the texture atlas with a single call to glDrawElements using VBO to transmit interlaced vertex data (coordinates, texture coordinates, color). I use the RGBA8888 texture format , drawing each image on two triangles (quadrangles) with glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) the glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) blend glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) . I do not use the depth buffer (in all cases).
Can someone tell me what could be the problem?
iphone opengl-es framebuffer fbo render-to-texture
sfider
source share