PDA

View Full Version : How to get compile time errors for calling non core profile OpenGL commands



vamsee
08-15-2012, 05:12 AM
Hi All,

My Background(if is needed)
Im pretty new to openGL, but i did some work in DirectX and HLSL, so i understand the 3d concepts and stuff.

The Question
How to get compile time errors for calling 'non core profile' OpenGL commands?

for example, glBegin and glVertex3f etc are not there in the core profile, but while learning openGL there are many references to these commands very frequently, and i want to go forward with the new core specs of openGL. And i have no clue what all GL commands are depricated.

SO, is there any way of getting compile time errors for trying to execute non core profile commands??

im using glew for handling the profile creation

wglCreateContextAttribsARB(hDC,0, attribs);

with atribs benig

int attribs[] =
{
WGL_CONTEXT_MAJOR_VERSION_ARB, 3,
WGL_CONTEXT_MINOR_VERSION_ARB, 3,
WGL_CONTEXT_FLAGS_ARB, 0,
0
};

Now, how do i make sure that i can get compile time errors for calling non core profile gl commands?

Alfonse Reinheart
08-15-2012, 05:50 AM
im using glew for handling the profile creation

That's not GLEW. Unless you're talking about how you're loading the function pointers.

Loading OpenGL functions is a runtime thing, so you can't do anything at compile-time to test. The absolute most you can do is use an OpenGL loading library that comes with headers that only provide functions for core OpenGL. GL3w (http://www.opengl.org/wiki/OpenGL_Loading_Library#GL3W) is one possibility, though you lose the ability to access extension functions. The Unofficial OpenGL SDK's GLLoad (http://www.opengl.org/wiki/OpenGL_Loading_Library#Unofficial_OpenGL_SDK) library provides headers for every OpenGL version, core and compatibility as you see fit. But you always get all of the extensions.

vamsee
08-16-2012, 10:44 AM
Thanks for your response, i will look into the possibilities you've mentioned.