Hi Mr Jack!
I've changed something in my code to stop enabling / disabling things each time a image is drawn and I've grouped those functions at the start and finish of the renderScene method, so now I have this:
Code:
-(void)renderScene
{
[EAGLContext setCurrentContext:context];
glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer);
glViewport(0, 0, backingWidth, backingHeight);
// Clear screen
glClear(GL_COLOR_BUFFER_BIT);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
// Enable Texture_2D
glEnable(GL_TEXTURE_2D);
// Assuming OpenGL is now initialized, here goes all draw methods...
(... draw backgrounds and all game elements here with the "renderAtPoint" method...)
glDisable(GL_TEXTURE_2D);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer);
[context presentRenderbuffer:GL_RENDERBUFFER_OES];
}
- (void)renderAt:(CGPoint)point texCoords:(GLfloat[])texCoords quadVertices:(GLfloat[])quadVertices{
glPushMatrix();
glTranslatef(point.x, point.y, 0.0f);
glRotatef(-rotation, 0.0f, 0.0f, 1.0f);
glScalef(scale, scale, 1.0f);
glColor4f(colourFilter[0], colourFilter[1], colourFilter[2], colourFilter[3]);
glBindTexture(GL_TEXTURE_2D, [texture name]);
glVertexPointer(2, GL_FLOAT, 0, quadVertices);
glTexCoordPointer(2, GL_FLOAT, 0, texCoords);
// Only enable blending if the image have transparencies
if (!noTransparent) {
glEnable(GL_BLEND);
}
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
if (!noTransparent) {
glDisable(GL_BLEND);
}
glPopMatrix();
}
Is this what you're meaning? Sorry but I don't know much about OpenGl...
Maybe the "glPushMatrix" and the "glPopMatrix" shouldn't be called for each image?
Thanks!