when I use :
GLFloat* buffer=NULL;
glReadPixels(0, 0, width, height, GL_RGB, GL_FLOAT, buffer );
to get openGL frame, the variable buffer remains NULL. what’s wrong with it?
I am using MFC windows to display OpenGL view. the OpenGL viewport is set larger than the window size.
please help me
Robbo
June 16, 2002, 12:56am
2
Originally posted by huangzl99:
[b]when I use :
GLFloat* buffer=NULL;
glReadPixels(0, 0, width, height, GL_RGB, GL_FLOAT, buffer );
to get openGL frame, the variable buffer remains NULL. what’s wrong with it?
I am using MFC windows to display OpenGL view. the OpenGL viewport is set larger than the window size.
please help me
[/b]
Try this:
GLFloat buffer[WIDTHHEIGHT 3];
glReadPixels(0, 0, width, height, GL_RGB, GL_FLOAT, buffer );
glReadPixels will ignore the entire command because the buffer you passed in is NULL. You need to pass in a pointer to a block of memory within which to place the pixel data.
I’ve never used glReadPixels, so the above might not quite be right -