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

Author Topic: SFML 2 OpenGL Contexts and GLEW  (Read 4485 times)

0 Members and 1 Guest are viewing this topic.

xRedx22

  • Newbie
  • *
  • Posts: 6
    • View Profile
SFML 2 OpenGL Contexts and GLEW
« on: April 10, 2010, 09:47:26 pm »
I figured out how to create an OpenGL context without a window, but I couldn't figure out how to set the version of the context and then create a window using the same context.

Basically, what I am trying to do is create an OpenGL 3.2 context, check shader extensions with GLEW, and then display a window. Is there anyway to do this with the SFML 2 window package and GLEW?

Oz1571

  • Newbie
  • *
  • Posts: 28
    • View Profile
SFML 2 OpenGL Contexts and GLEW
« Reply #1 on: April 11, 2010, 05:31:42 am »
Code: [Select]
  sf::VideoMode mode;
mode.Width = 1024;
mode.Height = 768;
mode.BitsPerPixel = 32;

sf::ContextSettings settings;
settings.DepthBits = 24;
settings.StencilBits = 8;
settings.AntialiasingLevel = 4;
settings.MajorVersion = 3;
settings.MinorVersion = 2;

Screen.Create(mode, title, sf::Style::Fullscreen, settings);


Is that what you are looking for?

xRedx22

  • Newbie
  • *
  • Posts: 6
    • View Profile
SFML 2 OpenGL Contexts and GLEW
« Reply #2 on: April 11, 2010, 05:52:29 am »
Actually, I gave up on creating the context before, so I just want to use GLEW calls, but thanks for helping.

My main problem now is that I tried creating a context with MajorVersion 3 settings, but when I use GLEW, it doesn't say OpenGL 3 is supported in the context (which I know my hardware supports from previous tests).

Is there anything special I have to do with GLEW to get this to work?

Oz1571

  • Newbie
  • *
  • Posts: 28
    • View Profile
SFML 2 OpenGL Contexts and GLEW
« Reply #3 on: April 11, 2010, 09:30:47 am »
I don't think so, I'm not having any issues with a 3.2 context myself. :/

xRedx22

  • Newbie
  • *
  • Posts: 6
    • View Profile
SFML 2 OpenGL Contexts and GLEW
« Reply #4 on: April 11, 2010, 09:00:04 pm »
Are you adding GLEW from source?
Because that's what I am doing.

Could you explain what you did with GLEW to get it to work with SFML 2 so I could try that?

Oz1571

  • Newbie
  • *
  • Posts: 28
    • View Profile
SFML 2 OpenGL Contexts and GLEW
« Reply #5 on: April 11, 2010, 09:20:12 pm »
No, I seem to recall I had issues with that, possibly because of a conflict with SFML's own GLEW. At the time it was easier for me to just handle the extensions myself, manually, but if you come up with a better way of handling it, you should share it. :)

xRedx22

  • Newbie
  • *
  • Posts: 6
    • View Profile
SFML 2 OpenGL Contexts and GLEW
« Reply #6 on: April 12, 2010, 12:23:48 am »
Well, I got it to work with GLee, so I guess my GLEW and the internal GLEW were conflicting with each other.

panithadrum

  • Sr. Member
  • ****
  • Posts: 304
    • View Profile
    • Skyrpex@Github
    • Email
SFML 2 OpenGL Contexts and GLEW
« Reply #7 on: April 12, 2010, 08:15:22 am »
Are you sure you have a correct context before initializing and callid Glew? I do this way in SFML2:
Code: [Select]
{
    sf::Context context;
    GlewInit();
    GlewCalls();
}


Maybe that isn't what you are looking for.

xRedx22

  • Newbie
  • *
  • Posts: 6
    • View Profile
SFML 2 OpenGL Contexts and GLEW
« Reply #8 on: April 12, 2010, 10:31:32 pm »
I just realized that I was initializing GLEW before I called GLEW_VERSION_3_0  :oops:

Well anyways, thanks for helping me with a problem that didn't need fixing.  :)

 

anything