brinck
06-07-2007, 07:42 AM
Hi,
I have a situation where I would like to mirror my framebuffer (which is 1024 x 1024) horizontally.
I'm using the following code but it's not working, all I get is a white screen.
glEnable(GL_TEXTURE_2D);
GLuint id;
glGenTextures(1, &id);
glBindTexture(GL_TEXTURE_2D, id);
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 0, 0, 1024, 1024, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glDisable(GL_DEPTH_TEST);
glDepthMask(GL_FALSE);
glDisable(GL_CULL_FACE);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glDisable(GL_LIGHTING);
glDisable(GL_FOG);
glDisable(GL_COLOR_MATERIAL);
glDisable(GL_BLEND);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glBegin(GL_TRIANGLES);
{
glTexCoord2f(1.0f, 0.0f);
glVertex2f(-1.0f, -1.0f);
glTexCoord2f(-1.0f, 0.0f);
glVertex2f(3.0f, -1.0f);
glTexCoord2f(1.0f, 2.0f);
glVertex2f(-1.0f, 3.0f);
}
glEnd();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
glDeleteTextures(1, &id);Ideas?
/A.B.
I have a situation where I would like to mirror my framebuffer (which is 1024 x 1024) horizontally.
I'm using the following code but it's not working, all I get is a white screen.
glEnable(GL_TEXTURE_2D);
GLuint id;
glGenTextures(1, &id);
glBindTexture(GL_TEXTURE_2D, id);
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 0, 0, 1024, 1024, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glDisable(GL_DEPTH_TEST);
glDepthMask(GL_FALSE);
glDisable(GL_CULL_FACE);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glDisable(GL_LIGHTING);
glDisable(GL_FOG);
glDisable(GL_COLOR_MATERIAL);
glDisable(GL_BLEND);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glBegin(GL_TRIANGLES);
{
glTexCoord2f(1.0f, 0.0f);
glVertex2f(-1.0f, -1.0f);
glTexCoord2f(-1.0f, 0.0f);
glVertex2f(3.0f, -1.0f);
glTexCoord2f(1.0f, 2.0f);
glVertex2f(-1.0f, 3.0f);
}
glEnd();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
glDeleteTextures(1, &id);Ideas?
/A.B.