Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SFML OpenGL context 3.3 not working?  (Read 6422 times)

0 Members and 1 Guest are viewing this topic.

Syntactic Fructose

  • Jr. Member
  • **
  • Posts: 80
  • Overflowing stacks and eating snacks
    • View Profile
SFML OpenGL context 3.3 not working?
« 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?                      

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: SFML OpenGL context 3.3 not working?
« Reply #1 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.
« Last Edit: May 23, 2014, 07:07:13 pm by Jesper Juhl »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: SFML OpenGL context 3.3 not working?
« Reply #2 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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Syntactic Fructose

  • Jr. Member
  • **
  • Posts: 80
  • Overflowing stacks and eating snacks
    • View Profile
Re: SFML OpenGL context 3.3 not working?
« Reply #3 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

Syntactic Fructose

  • Jr. Member
  • **
  • Posts: 80
  • Overflowing stacks and eating snacks
    • View Profile
Re: SFML OpenGL context 3.3 not working?
« Reply #4 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.

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: SFML OpenGL context 3.3 not working?
« Reply #5 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.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Syntactic Fructose

  • Jr. Member
  • **
  • Posts: 80
  • Overflowing stacks and eating snacks
    • View Profile
Re: SFML OpenGL context 3.3 not working?
« Reply #6 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

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: SFML OpenGL context 3.3 not working?
« Reply #7 on: June 04, 2014, 09:23:56 am »
10.18.10.3496
I feel sorry for you ;). Looks like they have been having a hard time with GLSL among other things.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).