PDA

View Full Version : Restrict OpenGL to core functionalities.



McLeary
04-11-2012, 11:17 AM
I take a look at the forum but didn't finding anything about it. In the learning process of OpenGL many tutorials use OpenGL 2.1 (glBegin, glEnd, etc). Is there a way to restrict the available functions to only the core version and avoid the deprecated with some compiler error?

Ilian Dinev
04-11-2012, 11:45 AM
You create a core context. And in GLSL use "#version 330 core" . That's all.

No compiler error will be generated, just a crash on calling a function that wglGetProcAddress naturally returned NULL for, or a glGetError() returning invalid_enum after using some existing deprecated functions.

Alfonse Reinheart
04-11-2012, 11:58 AM
Well, you could include a header that only provides the core functions (and extensions). Most OpenGL Loading Libraries (http://www.opengl.org/wiki/OpenGL_Loading_Library) don't provide these, but some do. GL3w only offers core functions, and the Unofficial GL SDK offers both core and compatibility headers.