Using glReadPixels in win2k

Started by
0 comments, last by davidko 22 years, 7 months ago
Has anyone out there had problems using glReadPixels? Somehow, it''s only outputting the background color. Can someone tell me if there''s something wrong with the code?
      
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
//

// draw the polygon using glBegin(GL_POLYGON), etc. etc.

//

int size = screenwidth * screenheight*3;
unsigned char *pixels = new unsigned char[size];

glReadPixels(0, 0, screenwidth, screenheight,
             GL_RGB, GL_UNSIGNED_BYTE, pixels);
      
I don''t usually make people read my code before I search the web for possible answers, but I''m somewhat stumped...and feel pretty dumb since I know there''s a really easy solution to this...
Advertisement
try doing a glFlush() or glFinish() first

This topic is closed to new replies.

Advertisement