Note that there are some explanatory texts on larger screens.

plurals
  1. POOpenGL extensions, how to use them correctly in C and glsl
    primarykey
    data
    text
    <p>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.</p> <p>EDIT: Meanwhile, part of the question is answered - read on at the next EDIT:</p> <p>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 <strong>#extension GL_EXT_gpu_shader4 : enable</strong> 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.</p> <p>But ever since I started using geometry shaders, my nightmare has begun. For some reason, mac expects me to use <strong>#extension GL_EXT_gpu_shader4 : enable</strong> while windows expects me to use <strong>#extension GL_EXT_geometry_shader4 : enable</strong>. This makes it less obvious to create a platform independent shader.</p> <p>Also, and this is even more annoying: Windows version wants me to use: <strong>glTransformFeedbackVaryings</strong> and I would think that GLEW would make it available to the mac but there I explicitly need to use <strong>glTransformFeedbackVaryingsEXT</strong> which will not work on the windows version. So I need to #ifdef for <strong>APPLE</strong> to use what's needed. Same problem with <strong>glBeginTransformFeedback</strong> and <strong>glBeginTransformFeedbackEXT</strong>.</p> <p>But both accept <strong>glProgramParameteriEXT</strong>, there I don't need the distiction...</p> <p>I understand that it's only with the transform feedback that I am having the problem, but... what is this all about?</p> <p>I thought I understood how OpenGL extensions worked, but I am starting to lose that understanding.</p> <p>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.</p> <p>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?</p> <p>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 <strong>#extension GL_EXT_gpu_shader4 : enable</strong> from my shaders. The only thing that makes me worry now is that for geometry shaders, I need the function <strong>glProgramParameteri</strong> which doesn't seem to exist, but <strong>glProgramParameteriEXT</strong> does. For some reason, this function also works on Windows. Why? Can I be certain that it will work on all systems/hardware?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload