PDA

View Full Version : picking a glsl version



shultays
09-10-2017, 03:53 PM
Hello!

I am working on an opengl game for Windows. Recently I made an open beta and got some feedback (and crash reports) on it.

My biggest problem is compiling shaders. Previously I was not specifiying any glsl version (not using version pragma) and it was causing problems when I do non-standard things. I have a very forgiving compiler for glsl but as far as I can see most people don't

Then I picked #version 450, fixed all errors and sent it to beta. The first I crash got was

Version number not supported by GL2

Then I reduced my version 150 and it worked fine for that reporter. However after that I received this one from another person:

version '150' is not supported

I reduced it to 110 now. But I don't know if what I am doing is correct or sane. 150 is already 8 years old, and now I am pushing it to 110.

Should I do that? Is there any problems with using lower versions of glsl? I am not doing anything fancy in my shaders so I don't think I need the features of newer versions.

Or maybe I shouldn't use version pragma at all. I can enable version 110 while developing, compile my shaders for version 110, and then comment out version pragmas and hope that whatever version my players has enough for it.

Alfonse Reinheart
09-10-2017, 06:29 PM
You pick the GLSL version for the version of OpenGL that is your minimum supported version (https://www.khronos.org/opengl/wiki/Core_Language_(GLSL)#Version). If your minimum supported GL version is 2.1, then your GLSL version should be 1.10. If your minimum supported version is GL 4.1, then your GLSL version should be 4.10.

shultays
09-11-2017, 01:36 PM
You pick the GLSL version for the version of OpenGL that is your minimum supported version (https://www.khronos.org/opengl/wiki/Core_Language_(GLSL)#Version). If your minimum supported GL version is 2.1, then your GLSL version should be 1.10. If your minimum supported version is GL 4.1, then your GLSL version should be 4.10.

Hmm, my opengl version is 3.2 and I was using #version 150 but I still received this error:

ERROR: 0:1: '' : version '150' is not supported

I am using SDL to create my windows and this means I am using 3.2 right? Or is this just a hint for sdl?


SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);

Silence
09-11-2017, 10:51 PM
Hmm, my opengl version is 3.2 and I was using #version 150 but I still received this error:

ERROR: 0:1: '' : version '150' is not supported

From what you said in your first topic, we can suppose that this error comes from a particular user, not yourself.

You should check the OpenGL version as soon as your context is created. Just report an error and close your program if the current OpenGL version is less than 3.2. People who don't have the required hardware/drivers will not be able to launch your game, and this is the best that you can do.

shultays
09-12-2017, 02:48 PM
From what you said in your first topic, we can suppose that this error comes from a particular user, not yourself.

You should check the OpenGL version as soon as your context is created. Just report an error and close your program if the current OpenGL version is less than 3.2. People who don't have the required hardware/drivers will not be able to launch your game, and this is the best that you can do.

OK then, thanks for answers!