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

Author Topic: OpenGL / GLSL versions in SFML 2.0 ?  (Read 4620 times)

0 Members and 1 Guest are viewing this topic.

dydya-stepa

  • Jr. Member
  • **
  • Posts: 82
    • View Profile
OpenGL / GLSL versions in SFML 2.0 ?
« on: November 06, 2011, 12:03:46 pm »
which versions of opengl and glsl sfml supports ?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
OpenGL / GLSL versions in SFML 2.0 ?
« Reply #1 on: November 06, 2011, 01:21:29 pm »
This question doesn't make sense. SFML doesn't support anything, it rather depends on the target graphics card.

Some GPUs may not support shaders at all, some others may support it but with a limited set of GLSL instructions, etc...
Laurent Gomila - SFML developer

dydya-stepa

  • Jr. Member
  • **
  • Posts: 82
    • View Profile
OpenGL / GLSL versions in SFML 2.0 ?
« Reply #2 on: November 06, 2011, 01:29:39 pm »
ok, which opengl / shader context or whatever it creates by default?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
OpenGL / GLSL versions in SFML 2.0 ?
« Reply #3 on: November 06, 2011, 01:53:40 pm »
It creates a "regular" context by default, but you can enable contexts >= 3.0 when you create the window, and choose a specific context version.
Laurent Gomila - SFML developer

dydya-stepa

  • Jr. Member
  • **
  • Posts: 82
    • View Profile
OpenGL / GLSL versions in SFML 2.0 ?
« Reply #4 on: November 06, 2011, 02:26:10 pm »
when i call Shader::IsAvailable() what it checks? if i get true - what version of shaders should i write my app against ?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
OpenGL / GLSL versions in SFML 2.0 ?
« Reply #5 on: November 06, 2011, 06:59:15 pm »
Quote
when i call Shader::IsAvailable() what it checks?

It checks the following extensions:
Code: [Select]
ARB_shading_language_100
ARB_shader_objects
ARB_vertex_shader
ARB_fragment_shader

This is the minimum to get shaders working.

Quote
if i get true - what version of shaders should i write my app against ?

The version that the graphics card supports. I don't know how to retrieve it (I don't even know if it's possible), so there's no way to check this with SFML.
Laurent Gomila - SFML developer

Richy19

  • Full Member
  • ***
  • Posts: 190
    • View Profile
OpenGL / GLSL versions in SFML 2.0 ?
« Reply #6 on: November 07, 2011, 05:13:53 pm »
Using this table
Code: [Select]

GLSL Version              OpenGL Version
1.10.59                     2.0
1.20.8                      2.1
1.30.10                     3.0
1.40.08                     3.1
1.50.11                     3.2
3.30.6                      3.3
4.00.9                      4.0
4.10.6                      4.1
4.20.6                      4.2

You can get the current OpenGL version used with:

Code: [Select]
std::cout << "Using OpenGL " << App.GetSettings().MajorVersion << "." << App.GetSettings().MinorVersion << std::endl;

And write the shader code that is supported by the openGL version

dydya-stepa

  • Jr. Member
  • **
  • Posts: 82
    • View Profile
OpenGL / GLSL versions in SFML 2.0 ?
« Reply #7 on: November 07, 2011, 06:55:25 pm »
thanks! that's what i needed