Simple glGetintegerv() question.

This program:

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

int
main(void)
{
	GLint deepness = 0;

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

	return 0;
}

simply returns always zero. Why?

Because you need a create a valid OpenGL rendering context using the plattform specific initialzation mechanism before you can issue any OpenGL calls.

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?

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.