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

Author Topic: Creating OpenGL 3.2 Context  (Read 4709 times)

0 Members and 1 Guest are viewing this topic.

aXyde

  • Newbie
  • *
  • Posts: 2
    • View Profile
Creating OpenGL 3.2 Context
« on: November 07, 2009, 01:15:01 pm »
Hi,

As the topic says: How do i create an OpenGL 3.2 Context with SFML. I saw in some tutorial[1] that for SDL you would just have to call SDL_GL_SetAttribute(). Is there an equivalent way for doing this with SFML?

Greets

[1] http://www.opengl.org/wiki/Tutorial1:_Creating_a_Cross_Platform_OpenGL_3.2_Context_in_SDL_(C_/_SDL)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Creating OpenGL 3.2 Context
« Reply #1 on: November 07, 2009, 01:40:17 pm »
There's no way to do it with SFML 1.5.

In the latest SVN revisions of SFML 2, you can do it like this:
Code: [Select]
sf::ContextSettings settings;
settings.MajorVersion = 3;
settings.MinorVersion = 2;

sf::Window window(mode, title, style, settings);
Laurent Gomila - SFML developer

enigma

  • Newbie
  • *
  • Posts: 6
    • View Profile
Creating OpenGL 3.2 Context
« Reply #2 on: January 09, 2010, 04:37:04 pm »
Hi to all,
I'm new to SFML, but I'm trying it, and is a very nice library.
I need to create an OpenGL 3.2 context (for working with the core specification). I've downloaded and compiled SFML 2.0, but I can't find this class:
Code: [Select]

sf::ContextSettings settings;

Thanks!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Creating OpenGL 3.2 Context
« Reply #3 on: January 09, 2010, 06:19:55 pm »
Well, it is there.

What does "I can't find this class" mean? Do you have a compile error?
Laurent Gomila - SFML developer

enigma

  • Newbie
  • *
  • Posts: 6
    • View Profile
Creating OpenGL 3.2 Context
« Reply #4 on: January 10, 2010, 01:44:04 am »
Quote from: "Laurent"

What does "I can't find this class" mean? Do you have a compile error?


Yes, 'ContextSetting' is not a member of 'sf'.
Note, I include only Window.hpp.
Thanks.

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
Creating OpenGL 3.2 Context
« Reply #5 on: January 10, 2010, 03:01:57 am »
Quote from: "enigma"
Quote from: "Laurent"

What does "I can't find this class" mean? Do you have a compile error?


Yes, 'ContextSetting' is not a member of 'sf'.
Note, I include only Window.hpp.
Thanks.
The class is sf::ContextSettings, not sf::ContextSetting.
I use the latest build of SFML2

enigma

  • Newbie
  • *
  • Posts: 6
    • View Profile
Creating OpenGL 3.2 Context
« Reply #6 on: January 10, 2010, 12:49:20 pm »
Quote from: "OniLink10"

The class is sf::ContextSettings, not sf::ContextSetting.


Yes, is my mistake to write to the forum.
But I don't understand where is the problem.

enigma

  • Newbie
  • *
  • Posts: 6
    • View Profile
Creating OpenGL 3.2 Context
« Reply #7 on: January 10, 2010, 02:30:16 pm »
Solved  :D !
I had downloaded an old (wrong) version of SFML 2.0  :oops: by this link.
Sorry  :oops:!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Creating OpenGL 3.2 Context
« Reply #8 on: January 10, 2010, 04:53:06 pm »
This is not an old / wrong version, this is the trunk which is the future SFML 1.6. SFML 2 is a separate branch (branches/sfml2), so that I can maintain both at the same time.
Laurent Gomila - SFML developer

enigma

  • Newbie
  • *
  • Posts: 6
    • View Profile
Creating OpenGL 3.2 Context
« Reply #9 on: January 11, 2010, 08:01:40 am »
Yes, it was my mistake, sorry  :D.
However thanks for help!