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

Author Topic: Does SFML work with modern OpenGL?  (Read 12934 times)

0 Members and 1 Guest are viewing this topic.

HKei

  • Newbie
  • *
  • Posts: 23
    • View Profile
Does SFML work with modern OpenGL?
« on: January 31, 2012, 01:48:48 pm »
Modern as in: OpenGL 3.3 Core/Forward Compatible. I'm currently just looking for an easy platform-independent way of creating an OpenGL context, preferably something nicer than GLUT, and thus stumbled upon SFML. Since it also provides a bunch of other stuff that I need or may need, it seems great to me, but still I am trying to avoid any OpenGL that isn't forward compatible (I am still learning OpenGL, and without the core/forward compatible flag I just wouldn't notice if I was using deprecated functionality, due to the nature of the many tutorials out there).



So uh... just what I wanted to ask: Is SFML compatible with OpenGL 3.3 / 4.x?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Does SFML work with modern OpenGL?
« Reply #1 on: January 31, 2012, 01:55:41 pm »
Contexts created by SFML use the compatibility profile flag, because SFML still uses some deprecated functions in its graphics module.

However:
- they should be replaced soon
- you can remove the compatibility flag in the source code and recompile SFML -- it will make no difference if you only use the sfml-window module
Laurent Gomila - SFML developer

HKei

  • Newbie
  • *
  • Posts: 23
    • View Profile
Does SFML work with modern OpenGL?
« Reply #2 on: January 31, 2012, 02:03:59 pm »
Ok, so as long as I steer clear of the graphics module (at least for now), I'll be fine? Thanks.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Does SFML work with modern OpenGL?
« Reply #3 on: January 31, 2012, 02:16:01 pm »
Quote
Ok, so as long as I steer clear of the graphics module (at least for now), I'll be fine?

Absolutely.
Laurent Gomila - SFML developer

TomCatFort

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • http://tomcatfort.net
Does SFML work with modern OpenGL?
« Reply #4 on: February 03, 2012, 06:45:26 pm »
A flag to create forward compatible context would be very good in SFML 2.0. Even if the graphics module don't support it. SFML already gives window and context creation, basic and very easy audio playback, and cross platform input. Allowing to chose core profile would greatly increase the current usefulness of SFML even if the graphics module is disabled.
Changing the source code, and recompiling it is not a good solution for the developers, especialy on systems where SFML will be (in the future) downloaded by a package manager already compiled.

I propose a solution for context setting modification:
Code: [Select]

enum ContextProfile
{
  CompatibilityProfile, //Default.
  ForwardCompatibleProfile,
};

Using it would require setting it in the ContextSettings instance.
Code: [Select]

ContextSettings cs(0, 0, 0, 3, 2, ForwardCompatibleProfile);

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Does SFML work with modern OpenGL?
« Reply #5 on: February 04, 2012, 08:34:39 am »
Quote from: "Laurent"
SFML still uses some deprecated functions in its graphics module.

However:
- they should be replaced soon
Laurent Gomila - SFML developer

Mars_999

  • Full Member
  • ***
  • Posts: 103
    • View Profile
    • Email
Does SFML work with modern OpenGL?
« Reply #6 on: February 10, 2012, 11:04:59 pm »
So will SFML2.0 require OpenGL3+ then? or will you still have access to GL2.1?

Thanks!

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Does SFML work with modern OpenGL?
« Reply #7 on: February 11, 2012, 02:53:49 am »
It still works fine with older versions (e.g. OpenGL 1.4/parts of 2.0 on my netbook), but some features might not work (e.g. shaders oder render to texture).

luiscubal

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
Does SFML work with modern OpenGL?
« Reply #8 on: February 14, 2012, 03:13:47 pm »
SFML 2.0 will (AFAIK) still use legacy features, being incompatible with core profile but supporting older OpenGL versions.

The whole "don't use legacy OpenGL" discussion seems to apply only to SFML 2.x (post-2.0). And even then, that wouldn't prevent SFML from running on older OpenGL. It would only mean no old functions when running on modern OpenGL versions.

Mars_999

  • Full Member
  • ***
  • Posts: 103
    • View Profile
    • Email
Does SFML work with modern OpenGL?
« Reply #9 on: February 18, 2012, 05:00:46 pm »
Well if I understand it, if you don't use CORE_PROFILE and use compatibility mode you can use GL2.1 and lower features with GL3+ features? If so why not just run SFML in compatibility mode then?

luiscubal

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
Does SFML work with modern OpenGL?
« Reply #10 on: February 18, 2012, 10:50:37 pm »
Quote from: "Mars_999"
If so why not just run SFML in compatibility mode then?

That is the current 2.0 behavior.

HKei

  • Newbie
  • *
  • Posts: 23
    • View Profile
Does SFML work with modern OpenGL?
« Reply #11 on: February 20, 2012, 10:30:02 pm »
Quote from: "Mars_999"
Well if I understand it, if you don't use CORE_PROFILE and use compatibility mode you can use GL2.1 and lower features with GL3+ features? If so why not just run SFML in compatibility mode then?


I believe I mentioned I wanted to use the Core profile.

Mars_999

  • Full Member
  • ***
  • Posts: 103
    • View Profile
    • Email
Does SFML work with modern OpenGL?
« Reply #12 on: February 21, 2012, 01:21:14 am »
Quote from: "HKei"
Quote from: "Mars_999"
Well if I understand it, if you don't use CORE_PROFILE and use compatibility mode you can use GL2.1 and lower features with GL3+ features? If so why not just run SFML in compatibility mode then?


I believe I mentioned I wanted to use the Core profile.


Yes you did. My point is no need as Compatibility mode works with GL3+ anyway... IIRC.

But I agree SFML should just allow the user to set a flag at the time the Render Context is created and set Core/Compatibility mode.