1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
void RenderScene()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity ();
gluOrtho2D(-8.0, 8.0, -5.0, 5.0);
glDisable (GL_DEPTH);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity ();
glTranslatef (0.0, 0.0, -5.0);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture.ID);
glColor3f(1.0f, 1.0f, 1.0f);
glBegin (GL_QUADS);
glTexCoord2f(.0,.0);
glVertex3f (-2, -1, -2.0);
glTexCoord2f(.0,1.0);
glVertex3f (-2, 1, -2.0);
glTexCoord2f(1.0,1.0);
glVertex3f (2, 1, -2.0);
glTexCoord2f(1.0,.0);
glVertex3f (2, -1, -2.0);
glEnd ();
glMatrixMode(GL_PROJECTION);
glLoadIdentity ();
gluPerspective(45, 1.0, 1.0, 20.0);
glMatrixMode(GL_MODELVIEW);
glEnable (GL_DEPTH);
glRotatef(xRotation, 1.0f, 0.0f, 0.0f);
glRotatef(yRotation, 0.0f, 1.0f, 0.0f);
glDisable(GL_TEXTURE_2D);
glColor3f(.0f, .0f, .0f);
glutSolidTeapot(1.0f);
glFlush();
glutSwapBuffers();
} |
Partager