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
| glClearColor(0.1, 0.0, 0.2, 0.0);
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
//dessine une scene dans une texture.
glViewport(0, 0, 256, 256);
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glPushMatrix();
glcolor3f(0,0.2,0.8);
DessinCube;// ma scene
glPopMatrix();
glBindTexture(GL_TEXTURE_2D, TextureRendue);
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 256, 256, 0);
//dessine un quad avec ma texture crée.
glViewport(0, 0, 800, 600);
glColor3f(1, 1, 1);
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
glBindTexture(GL_TEXTURE_2D, TextureRendue);
glBegin(GL_QUADS);
glTexCoord2i(0,0);glVertex3f(-2,-2,0);
glTexCoord2i(1,0);glVertex3f(-2, 2,0);
glTexCoord2i(1,1);glVertex3f( 2, 2,0);
glTexCoord2i(0,1);glVertex3f( 2,-2,0);
glEnd(); |