I am working on a game engine and it has evolved greatly. Because the engine needs to work on mac also, I am still using OpenGL 3.2 and GLSL 1.2 :-(. I use GLEW which I assumed would solve extension issues for me.
EDIT: Meanwhile, part of the question is answered - read on at the next EDIT:
I was always able to make shaders work on both windows and mac, sometimes I would have to add a line in the GLSL code like #extension GL_EXT_gpu_shader4 : enable to make it work on Mac. It then seems that my Windows version will give a warning when compiling the same shader, but it will work.
But ever since I started using geometry shaders, my nightmare has begun. For some reason, mac expects me to use #extension GL_EXT_gpu_shader4 : enable while windows expects me to use #extension GL_EXT_geometry_shader4 : enable. This makes it less obvious to create a platform independent shader.
Also, and this is even more annoying: Windows version wants me to use: glTransformFeedbackVaryings and I would think that GLEW would make it available to the mac but there I explicitly need to use glTransformFeedbackVaryingsEXT which will not work on the windows version. So I need to #ifdef for APPLE to use what's needed. Same problem with glBeginTransformFeedback and glBeginTransformFeedbackEXT.
But both accept glProgramParameteriEXT, there I don't need the distiction...
I understand that it's only with the transform feedback that I am having the problem, but... what is this all about?
I thought I understood how OpenGL extensions worked, but I am starting to lose that understanding.
It's getting to a point where I think that when I run the code on another windows system or another mac system or another linux system, I will have new problems because there are different graphics adapters or something.
Can anyone help me understand this? I have read the OpenGL manual about extensions, so I am missing something obvious. How can I make sure that my code will always work?
EDIT: By removing GLEW entirely from the Mac version and fully using the Mac's own OpenGL 3.2 implementation, all the namings are normal and I can entirely remove the #extension GL_EXT_gpu_shader4 : enable from my shaders. The only thing that makes me worry now is that for geometry shaders, I need the function glProgramParameteri which doesn't seem to exist, but glProgramParameteriEXT does. For some reason, this function also works on Windows. Why? Can I be certain that it will work on all systems/hardware?