SFML community forums

Help => Window => Topic started by: xRedx22 on April 10, 2010, 09:47:26 pm

Title: SFML 2 OpenGL Contexts and GLEW
Post by: xRedx22 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?
Title: SFML 2 OpenGL Contexts and GLEW
Post by: Oz1571 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?
Title: SFML 2 OpenGL Contexts and GLEW
Post by: xRedx22 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?
Title: SFML 2 OpenGL Contexts and GLEW
Post by: Oz1571 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. :/
Title: SFML 2 OpenGL Contexts and GLEW
Post by: xRedx22 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?
Title: SFML 2 OpenGL Contexts and GLEW
Post by: Oz1571 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. :)
Title: SFML 2 OpenGL Contexts and GLEW
Post by: xRedx22 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.
Title: SFML 2 OpenGL Contexts and GLEW
Post by: panithadrum 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.
Title: SFML 2 OpenGL Contexts and GLEW
Post by: xRedx22 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.  :)