Hi!
Now I want to project a perspective texture onto a polygon, and get a orthographic view of
the polygon. I did as following:
1.Mapp the texture to the plane
glTexCoord2f(0.0, 1.0);
glVertex3f(-1.0,-1.0, -1600);
glTexCoord2f(0.0, 0.0);
glVertex3f(-1.0, 1.0,-1600);
glTexCoord2f(1.0, 0.0);
glVertex3f( 1.0, 1.0,-1600);
glTexCoord2f(1.0, 1.0);
glVertex3f( 1.0,-1.0,-1600);
2.Set the texture matrix
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glTranslatef(0.5, 0.5, 0.0);
glScalef(0.5, 0.5, 1.0);
gluPerspective(20, 1, -1600, 1600);
glRotatef(10, 1.0, 0.0, 0.0);
glTranslatef(0.0, 0.0, -1600);
3.render the scene
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, 0.0, 2000);
DrawObject();
But I got an undesired result. I want to know what’s wrong with the method mentioned above?
Can anyone give me some suggestions?
Thank you in advance!