PDA

View Full Version : Texture Mapping Help2



Aliorithm
04-09-2005, 03:23 PM
Hi,
Below is my display method with a flat polygon defined before the gluLookAt() command. I cant figure out how to add a simple bitmap from paint to its front surface?? Any Help would be appreciated! Thanks

void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(100.0, 1.4, 5.0, 50.0);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

glPushMatrix();
glTranslatef(0.0, 0.0, -5.0);

//Need to combine bmp texture to this polygon!!!
glBegin(GL_POLYGON);
glVertex2f(8.0, -3.0);
glVertex2f(-8.0, -3.0);
glVertex2f(-8.0, -6.0);
glVertex2f(8.0, -6.0);
glEnd();
glPopMatrix();

gluLookAt(0.0, 5.0, 15.0, 3.0, 0.0, 0.0, 0.0, 1.0, 0.0);
/*glRotatef(angle, 0.0, 1.0, 0.0);*/

glPushMatrix();
lan();
glPopMatrix();

glPushMatrix();
glTranslatef(12.5, 0.0, 0.0);
glRotatef(angle, 0.0, 1.0, 0.0);
wan();
glPopMatrix();

glutSwapBuffers();

}

int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH | GLUT_RGB);
glutInitWindowSize(1000,700);
glutInitWindowPosition(12.5,10);
glutCreateWindow("Square");
init();
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutIdleFunc(update);
glutSpecialFunc(specialKeys);
glutKeyboardFunc(keyboard);
glutMainLoop();
return 0;
}

ALI

dvm
04-10-2005, 01:40 AM
Take a look here (http://nehe.gamedev.net)
You'll find tutorials about texturing