Skip to main content
GameDev.net gamedev.net
🔒 Locked

GLSL version considerations?

Started by blueshogun96 Mar 4, 2013 at 7:58 PM 4 replies 2.1k views
Original Post
blueshogun96
blueshogun96

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.

claesson92
claesson92

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.

blueshogun96
blueshogun96

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.

BrendanWebster
BrendanWebster

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?

21st Century Moose
21st Century Moose

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. 
blueshogun96
blueshogun96

^ 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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.