I use P-Buffer to reach a RTT as stated in certain some docs on nvidia developer center. No probs appear thru the implementation, but... ohhh, always the new texture appears inverted like bmp's format do. :dry: Any idea ?
Thanks.
P-Buffers With RTT
Started by MA-Mestre, Apr 24 2005 01:41 PM
4 replies to this topic
#1
Posted 24 April 2005 - 01:41 PM
#2
Posted 24 April 2005 - 02:13 PM
Inverted colour-wise, or inverted as in upside-down?
#3
Posted 24 April 2005 - 02:18 PM
upside down
Draw into p-buufer:
glBegin (GL_TRIANGLES);
glVertex3f (0.0f,5.0f,-15.0f);
glVertex3f (5.0f,-5.0f,-15.0f);
glVertex3f (-5.0f,-5.0f,-15.0f);
glEnd ();
Draw into Front Buffer
glEnable (GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, rtt.GetTexture());
glBegin(GL_TRIANGLE_STRIP);
glTexCoord2f(1.0f, 1.0f); glVertex3f(-5.0f,5.0f,-15.0f);
glTexCoord2f(1.0f, 0.0f); glVertex3f(-5.0f,-5.0f,-15.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f(5.0f,5.0f,-15.0f);
glTexCoord2f(0.0f, 0.0f); glVertex3f(5.0f,-5.0f,-15.0f);
glEnd();
glDisable(GL_TEXTURE_2D);
As u will see, the TexCoords are changed to show the texture correctly. Otherwise the texture appears upside-down.
Draw into p-buufer:
glBegin (GL_TRIANGLES);
glVertex3f (0.0f,5.0f,-15.0f);
glVertex3f (5.0f,-5.0f,-15.0f);
glVertex3f (-5.0f,-5.0f,-15.0f);
glEnd ();
Draw into Front Buffer
glEnable (GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, rtt.GetTexture());
glBegin(GL_TRIANGLE_STRIP);
glTexCoord2f(1.0f, 1.0f); glVertex3f(-5.0f,5.0f,-15.0f);
glTexCoord2f(1.0f, 0.0f); glVertex3f(-5.0f,-5.0f,-15.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f(5.0f,5.0f,-15.0f);
glTexCoord2f(0.0f, 0.0f); glVertex3f(5.0f,-5.0f,-15.0f);
glEnd();
glDisable(GL_TEXTURE_2D);
As u will see, the TexCoords are changed to show the texture correctly. Otherwise the texture appears upside-down.
#4
Posted 24 April 2005 - 05:29 PM
This is the natural way that textures work in OpenGL....their coordinate system has (0,0) on the bottom left and (1,1) on the top right. It is like a standard Cartesian coordinate system.
reedbeta.com - developer blog, OpenGL demos, and other projects
#5
Posted 29 April 2005 - 01:19 PM
Thanks :wub:
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












