PDA

View Full Version : glCreateShader(GL_VERTEX_SHADER) invalid enumerant



MusicManGP
05-12-2011, 02:51 PM
I've got a simple OpenGL app running, and as I was working towards getting some geometry shaders up and running I realized I wanted to make sure I was getting a 4.1 core profile context. This is my OpenGL initialization code:



glutInitContextVersion(4, 1);
glutInitContextFlags(GLUT_FORWARD_COMPATIBLE);
glutInitContextProfile(GLUT_CORE_PROFILE);


Regardless of if I keep the GLUT_FORWARD_COMPATIBLE in there, glCreateShader(GL_VERTEX_SHADER) is causing an Invalid Enumerant error. Can anyone point me in the right direction as to why I can't even create a 4.1 core profile vertex shader? I have the latest drivers, the latest versions of freeglut/glew, and my graphics card is a GeForce GTX 560.

Alfonse Reinheart
05-12-2011, 02:56 PM
If I recall, GLEW has some problems with core profiles. I don't remember exactly what it was, but I know they have an issue with them.

MusicManGP
05-12-2011, 03:54 PM
Indeed it seems GLEW will not work with OpenGL core profiles (certainly not 3 or 4); looks like I'm ditching glew.

przemo_li
05-13-2011, 01:35 AM
add:
"glewExperimental = GL_TRUE;"
before glewInit

BTW do you use GLEW? FreeGLUT is not enought to have api of opengl loaded! (on Win you need to load pointer to every OpenGL function from .dll, use GLEW to make it 2 lines of code)

Alfonse Reinheart
05-13-2011, 02:03 AM
BTW do you use GLEW? FreeGLUT is not enought to have api of opengl loaded! (on Win you need to load pointer to every OpenGL function from .dll, use GLEW to make it 2 lines of code)

Or you could use an extension loader that can tell the difference between core and compatibility without some kind of "experimental" hack. GLEW isn't the only extension loader in the world, you know.

V-man
05-13-2011, 07:15 AM
Yes, there are a few extension loaders
http://www.opengl.org/wiki/Extension_Loading_Library