GLSL version considerations?

Started by
4 comments, last by blueshogun96 11 years, 2 months ago

Now that I have OpenGL 3.2 working under MacOSX, now I'd like to know this: what version of GLSL is best to use?

Maybe it doesn't really matter, but I've seen some tutorials (for Windows) use 150 while others use 330 or higher. I haven't used GLSL as much as I should have so I'm not 100% sure. Been using Cg and HLSL mostly.

Thanks.

Shogun.

Advertisement

http://en.wikipedia.org/wiki/GLSL#Versions

That's a list of which GLSL version was released with what version of OpenGL.

The numbers declared in the files, such as 150 and 330 is the first and second part of the GLSL version number without the period (.) if I'm not mistaken.

Use an as new version as you can.

Edit: http://renderingpipeline.com/2012/03/shader-model-and-glsl-versions/ Another list with thier respective version numbers.

Okay, now I understand. 330 is for OpenGL 3.3. Since I'm confined to use OpenGL 3.2, I have to stick with 150. Thanks.

Shogun.

I would say use whatever version suits the code you are writing, if you are planning on using Immediate mode then you'll need to use GLSL 1.2 but if you plan on using Buffer Objects then go ahead and use 1.5. Seeing that you want to use OpenGL 3.2 I would expect that you plan on using Buffer Objects. Um, also do you have a specific reason to use OpenGL 3.2 over 3.3?

I would say use whatever version suits the code you are writing, if you are planning on using Immediate mode then you'll need to use GLSL 1.2 but if you plan on using Buffer Objects then go ahead and use 1.5. Seeing that you want to use OpenGL 3.2 I would expect that you plan on using Buffer Objects. Um, also do you have a specific reason to use OpenGL 3.2 over 3.3?

MaxOSX only supports GL3.2 so the OP has no choice in the matter.

An interesting alternative is to use immediate mode but with glVertexAttrib calls instead of the more familiar glVertex/glTexCoord/etc; may be useful as an intermediate step when converting old immediate mode code but I'm not sure if OSX allows it.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

^ This. When Apple decides it's time to update it's OpenGL implementation, then I can move on to a later version.

glVertexAttrib is new to me. I was hoping there would be something like this to make it a bit simpler to render 2D primitives (i.e. HUD) with dynamic vertex data. IMO a VBO would be overkill for that. I need to further research that API subset. Thanks for sharing!

Shogun.

This topic is closed to new replies.

Advertisement