PDA

View Full Version : glGetMinmax without rendering



diwksmfdj383439qpslo87239
01-31-2005, 01:07 PM
Hi,
I'm interested in obtaining the min and max color values in the GPU's color buffer, without actually obtaining a window handle or rendering anything to the screen. I believe the code should look something like this.

glMinmax(GL_MINMAX, GL_RGB, GL_FALSE);
glEnable(GL_MINMAX);
glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
glClear( GL_COLOR_BUFFER_BIT );
glBegin( GL_TRIANGLES );
glColor3f( 0.5f, 0.5f, 0.5f );
glVertex3f(0.1f, 0.1f, 0.0f);
glVertex3f(0.1f, 0.7f, 0.0f);
glVertex3f(0.7f, 0.7f, 0.0f);
glVertex3f(0.7f, 0.1f, 0.0f);
glEnd();
glFlush();
glGetMinmax(GL_MINMAX, GL_TRUE, GL_RGB, GL_FLOAT, values);

If I execute this code alone, without rendering anything to the screen, I get all 0's as my answer. If anyone can help with this, it'd be greatly appreciated,
Thanks,
Mike

mikael_aronsson
02-01-2005, 06:36 AM
You need to allocate an OpenGL context for any OpenGL API function to work.

Mikael

Bob
02-01-2005, 09:53 AM
And the minmax operation, aswell as pretty much the entire imaging subset, applies to pixel transfers only, not to rendered objects.

diwksmfdj383439qpslo87239
02-01-2005, 11:25 AM
Thanks, I seem to have figured out what I needed.
Mike