1

I am creating OpenGL context with version 3.2 on Windows 7.Then I initiate GLEW:

    GLenum err = glewInit();
glGetError();  
if (err != GLEW_OK){
    throw Exception(std::string((const char*)glewGetErrorString(err)));
     }

This part passes ok in all test cases.

Next I query for the GL version to make sure this is the expected one:

     GLint major =0, minor = 0;
 GL_ASSERT(glGetIntegerv(GL_MAJOR_VERSION, &major ));
 GL_ASSERT(glGetIntegerv(GL_MINOR_VERSION, &minor ));

On 2 machines out of 4 I am getting "invalid enumerant" already at the first query:

 GL_ASSERT(glGetIntegerv(GL_MAJOR_VERSION, &major ));

The tested machines hardware :

  1. NoteBook - Nvidia GeForce GT 630m ,OpenGL 4.3 - fails.

  2. Desktop PC -Nvidia GeForce 550GTX ,OpenGL 4.3 -fails.

  3. Desktop PC -Nvidia Quadro K4000 ,OpenGL 4.4 -passes.

  4. Desktop PC -Nvidia Quadro 4000 ,OpenGL 4.3 -passes.

This is really weird as all of these machines have latest drivers installed and run OpenGL based apps up to their highest supported by the installed driver just fine.Also,if I don't perform the query for the version the rest of the app works ok.Why does it happen?

Michael IV
  • 11,016
  • 12
  • 92
  • 223
  • 1
    Are you sure you were successful in creating the OpenGL context? – Joseph Mansfield Jan 20 '14 at 09:01
  • Sure 100%.As I said,if I don't perform the query the app works ok.Also I have exception handling on context as well.It would trow there if it failed. – Michael IV Jan 20 '14 at 09:30
  • Gets errors from glGetError and returns error message – Michael IV Jan 20 '14 at 09:43
  • there is a tool called GPU Caps I use it to check my openGL version and externsions etc. Try it, and what it gives you. if it succeeds probably your context problem. – concept3d Jan 20 '14 at 09:45
  • http://www.ozone3d.net/gpu_caps_viewer/ – concept3d Jan 20 '14 at 09:46
  • @concept3d and why do I need it? I said already all the machines support up to GL4.X and I am setting 3.2.Also it all works without that version query. – Michael IV Jan 20 '14 at 09:54
  • Well, my point is just verification. The tool uses that exact query so if it fails, there might be a problem in the openGL driver implementation (though unlikely), otherwise it's your context setup which you didn't show us. – concept3d Jan 20 '14 at 09:57
  • I am confused by your code... `glGetIntegerv (...)` returns `void`. How is it that you are using the result of that call as an assertion? – Andon M. Coleman Jan 20 '14 at 12:15
  • @AndonM.Coleman inside the assert there is a method that checks for gl Errors...But now I think I know what is the problem.Read this : http://stackoverflow.com/questions/10857335/opengl-glgeterror-returns-invalid-enum-after-call-to-glewinit – Michael IV Jan 20 '14 at 12:17
  • Have you tried printing the actual version string out in the situations where it fails? The particular error you were discussing in the linked question is generally only relevant to core profile contexts. The version string will tell you if you have core or compatibility. – Andon M. Coleman Jan 20 '14 at 12:36
  • I am getting the exact same problem on Mac OS X 10.9 on a core 4.1 context. No idea why this is happening, [glGetIntegerv](https://www.opengl.org/sdk/docs/man4/xhtml/glGet.xml) explicitly mentions GL_MAJOR_VERSION as an allowed parameter. Edit: I should mention that I am not using GLEW and that context creation is working fine. – The Fiddler Feb 06 '14 at 15:09

1 Answers1

2

glGetIntegerv with GL_MAJOR_VERSION or GL_MINOR_VERSION is only supported on GL contexts with version 3.0 and above. See https://www.opengl.org/wiki/Get_Context_Info. If you get an "invalid enum" in response to either of these, it is highly likely that the context you have created does not support OpenGL 3.0 or later.

bleater
  • 5,098
  • 50
  • 48