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
|
unsigned int tex;
GLubyte *pixels = new GLubyte[1024*1024*4];
glReadBuffer(GL_FRONT);
glGenTextures(1,&tex);
glReadPixel(0,0,SCREEN_W,SCREEN_H,GL_RGBA,GL_UNSIGNED_BYTE,pixels);
glBindTexture (GL_TEXTURE_2D, tex);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA,1024,1024,0,GL_RGBA,GL_UNSIGNED_BYTE,pixels);
while(condition)
{
glBindTexture(GL_TEXTURE_2D, tex);
glBegin(GL_QUADS);
glTexCoord2i(0,0);
glVertex2i(0,0);
glTexCoord2i(1,0);
glVertex2i(SCREEN_W,0); // 800
glTexCoord2i(1,1);
glVertex2i(SCREEN_W,SCREEN_H); // 800*600
glTexCoord2i(0,1);
glVertex2i(0,SCREEN_H); // 600
glEnd();
... // affichage des éléments animés
allegro_gl_flip();
glClear(GL_COLOR_BUFFER_BIT);
}
delete [] pixels; |
Partager