Where does variable "GL_version_4_3" come from?

The book “OpenGL programming guide: the official guide to learning opengl, version 4.3” says in page 837 that there is a variable named “GL_version_4_3” in GLEW library that can determine the OpenGL version available, like the image below shows:


and in the next page the author even gives an example using this variable:


But when I copy the same code and compile, the VS2012 report an error: error C2065: ‘GL_version_4_3’ : undeclared identifier. The available OpenGL version on my computer is 4.4 through nVidia’s GT640 card and I’m using the GLEW 1.10.0 downloaded from Download The OpenGL Extension Wrangler Library from SourceForge.net. So, if the author isn’t kidding me, where does the variable “GL_version_4_3”, or “GL_version_4_4” come from (not macro defined by #define, but a variable that can be used in if (…))? Thank you.

Why don’t you use glGetString(GL_VERSION) instead?
From the previous post I have concluded you want to handle extensions by yourself. In that case you don’t need GLEW at all.

I’m self-studying OpenGL by reading that book because I think that book seems most up-to-date, so I was trying everything mentioned in that book. But now I can’t help but to believe that the only update of the book is its title (and cover color). PS: I tried glGetString(GL_VERSION), it really works. Thank you.

There is a proverb in my country that would sound on English like: “Read map but ask villagers!” :slight_smile:
So, read the book, but ask on the forum. :wink:

It is very good way to systematically learn something by reading some good book.
OpenGL Programming Guide was once the best (and only) resource for OpenGL. Nowadays it is not so. There is a proliferation of literature. Many of them are of questionable quality.
I’ve started to read the Red book ver.8, but gave up after first two chapters. There are some errors that can make beginners some wrong assumption.
When I (or better say “if I”) have enough time it would be nice to make a short overview of current state of the books about OpenGL. :slight_smile:

I think GL_VERSION_4_3 is a macro defined by glew. If it is defined it means that your glew version supports OpenGL 4.3. glGetString gets drivers’ version.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.