PDA

View Full Version : Where does variable "GL_version_4_3" come from?



zzzhhh
06-04-2014, 03:15 AM
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:

1331

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

1332

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 https://sourceforge.net/projects/glew/files/glew/1.10.0/glew-1.10.0-win32.zip/download. 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.

Aleksandar
06-04-2014, 04:35 AM
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.

zzzhhh
06-04-2014, 04:59 AM
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.

Aleksandar
06-04-2014, 05:33 AM
There is a proverb in my country that would sound on English like: "Read map but ask villagers!" :)
So, read the book, but ask on the forum. ;)

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. :)

rodrigoloc
06-04-2014, 12:32 PM
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.