problems with rendering to texture
- From: Sławomir Kośmider <skosmider@xxxxxxxxxxxxxxxxxxx>
- Date: Thu, 18 May 2006 19:44:30 +0200
Hi.
I have a problem with rendering to texture. I'm using glCopyTexImage2D
function. When I'm trying to render a cube where each vertex has different
color I get texture with image of cube having all vertices with the same
colour. Precisely this is the colour of the last rendered vertex.
int viewport[4];
glGetIntegerv(GL_VIEWPORT,(int*)viewport);
glViewport(0,0,w,h);
/*The cube is untextured so I have to turn of the texturing
to display colors. Maybe this is the problem. */
glDisable(GL_TEXTURE_2D);
/*here I'm rendering the cube*/
renderCube();
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture[0]);
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, w, h, 0);
glViewport(viewport[0],viewport[1],viewport[2],viewport[3]);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f);
glVertex3f(0.0f, 0.0f,0.0f);
glTexCoord2f(1.0f, 0.0f);
glVertex3f(1.0f, 0.0f,0.0f);
glTexCoord2f(1.0f, 1.0f);
glVertex3f(1.0f, 1.0f, 0.0f);
glTexCoord2f(0.0f, 1.0f);
glVertex3f(0.0f, 1.0f, 0.0f);
glEnd();
Can anyone help?
Thanks.
.
- Prev by Date: Re: Drawing antialiased lines.
- Next by Date: wglMakeCurrent deadlock
- Previous by thread: Drawing antialiased lines.
- Next by thread: wglMakeCurrent deadlock
- Index(es):
Relevant Pages
|
Loading