SFML community forums

Help => Window => Topic started by: Syntactic Fructose on May 23, 2014, 06:53:55 pm

Title: SFML OpenGL context 3.3 not working?
Post by: Syntactic Fructose on May 23, 2014, 06:53:55 pm
I'm currently trying to run a modern OpenGL program and am using SFML to handle my window, but I'm running into an error with GLSL. It gives me a warning:

Quote
WARNING: 0:29: Only GLSL version > 110 allows postfix "F" or "f" for float

Although my GLSL shaders specifically say at the top:
#version 330 core

and my SFML window context settings read:
sf::Window window(sf::VideoMode(800,600),       //declare window
                "Particle Simulation",                                  //window title
                sf::Style::Default,
                sf::ContextSettings(32, 8, 0, 3, 3)
                );     
   

I checked and my graphics card does support OpenGL 3.3 and higher, so it seems i'm doing something wrong with either SFML or reading in my shaders

what am I doing wrong?                      
Title: Re: SFML OpenGL context 3.3 not working?
Post by: Jesper Juhl on May 23, 2014, 06:58:37 pm
I believe this may be what you are looking for:
http://www.sfml-dev.org/documentation/2.1/structsf_1_1ContextSettings.php
http://www.sfml-dev.org/tutorials/2.1/window-opengl.php
Specifically, setting the major and minor version of the requested context.

Edit: aargh, I'm an idiot. Somehow I missed that you *do* request a 3.3 context :( Just ignore what I said.
Title: Re: SFML OpenGL context 3.3 not working?
Post by: eXpl0it3r on May 23, 2014, 07:46:48 pm
Are you by any chance on Linux?
Because the mesa driver requires a 3.1 core profile for OpenGL 3.3, which does not work with SFML.
Title: Re: SFML OpenGL context 3.3 not working?
Post by: Syntactic Fructose on May 23, 2014, 09:00:14 pm
Are you by any chance on Linux?
Because the mesa driver requires a 3.1 core profile for OpenGL 3.3, which does not work with SFML.

Nope  :-\ Currently running window 8.1 with Visual studio 2012
Title: Re: SFML OpenGL context 3.3 not working?
Post by: Syntactic Fructose on May 31, 2014, 06:38:07 pm
Any ideas? I'm not sure if SFML is actually allowing the use of
f
since it's just a warning, but I'd like to get to the bottom of this.
Title: Re: SFML OpenGL context 3.3 not working?
Post by: binary1248 on May 31, 2014, 07:04:09 pm
I use #version 430 and it works for me. You don't need to specify core explicitly since it is the default. I also don't ask for a specific GL version because most of the time you automatically get a compatibility version of the latest context anyway (I get 4.4). You can test this yourself. Leave out the version request and check what version you get. SFML always requests a 2.0 legacy context by default but it probably never really gets one ;).

And if you still can't fix that warning, it isn't really SFML's fault since it is your driver complaining about your shader. SFML doesn't look at any of the source. It might end up being just another driver bug.
Title: Re: SFML OpenGL context 3.3 not working?
Post by: Syntactic Fructose on June 04, 2014, 04:33:23 am
I use #version 430 and it works for me. You don't need to specify core explicitly since it is the default. I also don't ask for a specific GL version because most of the time you automatically get a compatibility version of the latest context anyway (I get 4.4). You can test this yourself. Leave out the version request and check what version you get. SFML always requests a 2.0 legacy context by default but it probably never really gets one ;).

And if you still can't fix that warning, it isn't really SFML's fault since it is your driver complaining about your shader. SFML doesn't look at any of the source. It might end up being just another driver bug.

leaving out the #versions actually gives me an even stranger error, I made sure to add the line

const unsigned char* version = (const unsigned char*)glGetString(GL_SHADING_LANGUAGE_VERSION);
        printf("Running GLSL Version %s\n",version);

to see what version I was running, looks like a bug as SFML correctly set the version to 330...not sure where to go from here. Funny though everytime still works perfectly fine, program runs as usual.

Running GLSL Version 3.30 - Build 10.18.10.3496
Compiling shader : Shaders/vertexShader.vert
WARNING: 0:3: 'GL_ARB_explicit_attrib_location' :  extension is not available in
 current GLSL version
WARNING: 0:3: 'GL_ARB_explicit_attrib_location' :  extension is not available in
 current GLSL version
WARNING: 0:3: 'GL_ARB_explicit_attrib_location' :  extension is not available in
 current GLSL version
WARNING: 0:4: 'GL_ARB_explicit_attrib_location' :  extension is not available in
 current GLSL version
WARNING: 0:4: 'GL_ARB_explicit_attrib_location' :  extension is not available in
 current GLSL version
WARNING: 0:4: 'GL_ARB_explicit_attrib_location' :  extension is not available in
 current GLSL version
WARNING: 0:5: 'GL_ARB_explicit_attrib_location' :  extension is not available in
 current GLSL version
WARNING: 0:5: 'GL_ARB_explicit_attrib_location' :  extension is not available in
 current GLSL version
WARNING: 0:5: 'GL_ARB_explicit_attrib_location' :  extension is not available in
 current GLSL version


Compiling shader : Shaders/fragmentShader.frag

Linking program
Title: Re: SFML OpenGL context 3.3 not working?
Post by: binary1248 on June 04, 2014, 09:23:56 am
10.18.10.3496
I feel sorry for you ;). Looks like (https://communities.intel.com/message/163875) they have been having a hard time with GLSL among other things.