MaxH
02-14-2008, 03:11 PM
Having trouble displaying JPEG images with glDrawPixels(). Using the code below, I can input and display a jpeg image as a TEXTURE. This means the image is being read into 'TextureArray' correctly. Can 'TextureArray' be used as the last parameter to the glDrawPixels command? If so, what should the other parameters be? Thank you.
int DrawGLScene(GLvoid)
{
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity ();
glPushMatrix ();
glTranslatef (1.3, 0, -5);
glBindTexture (GL_TEXTURE_2D, TextureArray[0]);
glBegin (GL_QUADS);
glTexCoord2f (0, 1); glVertex3f (-1, 1, 0);
glTexCoord2f (0, 0); glVertex3f (-1, -1, 0);
glTexCoord2f (1, 0); glVertex3f ( 1, -1, 0);
glTexCoord2f (1, 1); glVertex3f ( 1, 1, 0);
glEnd();
glPopMatrix ();
glRasterPos3f (-2.0, -1.5, -6);
glDrawPixels (360, 450, GL_RGB, GL_UNSIGNED_INT, // ???
(void *)(TextureArray[0]));
return TRUE;
}
int DrawGLScene(GLvoid)
{
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity ();
glPushMatrix ();
glTranslatef (1.3, 0, -5);
glBindTexture (GL_TEXTURE_2D, TextureArray[0]);
glBegin (GL_QUADS);
glTexCoord2f (0, 1); glVertex3f (-1, 1, 0);
glTexCoord2f (0, 0); glVertex3f (-1, -1, 0);
glTexCoord2f (1, 0); glVertex3f ( 1, -1, 0);
glTexCoord2f (1, 1); glVertex3f ( 1, 1, 0);
glEnd();
glPopMatrix ();
glRasterPos3f (-2.0, -1.5, -6);
glDrawPixels (360, 450, GL_RGB, GL_UNSIGNED_INT, // ???
(void *)(TextureArray[0]));
return TRUE;
}