4

I had an issue with my shaders when I realized I'm using OpenGL 2.1 and GLSL 1.2. Due to the fact that geometry shaders are not supported until 1.5 I need to use another OpenGL, GLSL Version. But how? I think I read up to 15 threads but nothing worked for me.

My Mac is running on 10.9.3 with PyOpenGL 3.0.2. I've downloaded an OpenGL Extention Viewer to see what Versions and Extentions are supported. And the Intel HD Graphics 4000 as well as the NVIDIA GeForce 650M support OpenGL 3.2 in the Core Profile but not in die Compatibility Profile.

I assume that the Compatibility Profile is the fact why I can't compile geometry shaders. It just supports OpenGL up to 2.1.

I've tried to change the Profile like this:

glutInitContextVersion (3, 2)
glutInitContextProfile(GLUT_CORE_PROFILE)

but both functions are undefined. And the GL_SHADING_LANGUAGE_VERSION (1.2) and GL_VERSION 2.1 are still the same.

Due to another thread I used #version 150 core in my geometry shader but this also had no effect.

How can I change the Context/Version in order to use my geometry shaders?

Marc Radziwill
  • 175
  • 2
  • 12
  • So the compiler complains about an undeclared `glutInitContextVersion`? (I think it is not a _GLUT_ but a _FreeGLUT_ function) Did you try it [this way (It is an answer to a different question, but explains how to setup the core profile)](http://stackoverflow.com/a/20932820/1960455)? – t.niese Jun 21 '14 at 11:42
  • I've tried it with GLUT_3_2_CORE_PROFILE but i get this error "global name 'GLUT_3_2_CORE_PROFILE' is not defined". Like explained I tried it with glfw and installed it viw brew install glfw2 but still no effect. Would you recommend to use FreeGLUT? – Marc Radziwill Jun 21 '14 at 11:50
  • 2
    I would recommend to use **[GLFW](http://www.glfw.org/)** instead of GLUT, but you should use the current version 3 and not the old version 2 as the API of 3 is way better. The GLUT shipped with OS X itself is deprecated in `10.9`. Personally I use GLFW both on OS X and on Windows. – t.niese Jun 21 '14 at 11:53
  • Ok thanks. I just installed version 3 via brew but I'm not able to link glfw3 [like here](https://github.com/Homebrew/homebrew/issues/19670) and [here](http://stackoverflow.com/questions/16432071/how-to-fix-homebrew-permissions). As soon as I got this I'm tring to use GLFW. – Marc Radziwill Jun 21 '14 at 12:52
  • 3
    You have to be using FreeGLUT here, because the version of GLUT that ships with OS X does not even have `glutInitContextVersion (...)`. FreeGLUT ***only*** works with GLX on OS X at the moment, there is no native codepath through CGL/NSOpenGL, so it cannot get a 3.2 core context (XQuartz does not implement the necessary GLX extensions for that). You either need to use the version of GLUT that Apple provides, in which case `GLUT_3_2_CORE_PROFILE` is appropriate, or use something more sophisticated like glfw. – Andon M. Coleman Jun 21 '14 at 15:54

0 Answers0