Restrict OpenGL to core functionalities.

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?

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.

Well, you could include a header that only provides the core functions (and extensions). Most OpenGL Loading Libraries don’t provide these, but some do. GL3w only offers core functions, and the Unofficial GL SDK offers both core and compatibility headers.