PDA

View Full Version : Simple glGetintegerv() question.



mjordan
05-12-2005, 05:24 AM
This program:



/* -*-linux-c-*- */
#include <stdio.h>
#include <GL/gl.h>

int
main(void)
{
GLint deepness = 0;

glGetIntegerv(GL_MAX_LIST_NESTING, &amp;deepness);
printf("Max display list deepness: %d\n", deepness);

return 0;
}simply returns *always* zero. Why?

05-12-2005, 05:32 AM
Because you need a create a _valid_ OpenGL rendering context using the plattform specific initialzation mechanism before you can issue any OpenGL calls.

mjordan
05-12-2005, 05:37 AM
Thank you. This is not even mentioned on The OpenGL Programming Guide... By the way... Is this rule still valid for testing extension availability with GLEW?

05-12-2005, 06:09 AM
Originally posted by mjordan:
Is this rule still valid for testing extension availability with GLEW?Yes, since OpenGL is just an API it can have different implementations that can be selected based on the pixelformat you specify during the context creation (i.e. software emulation or hardware accelerated pixelformats...).

Since attributes like the maximum display list nesting or the supported extensions depend on the actual implementation you cant query them unless a implementation is initialized and "active".

All OpenGL calls issued before you have a valid rendering context will generate a GL_INVALID_OPERATION error.