SFML community forums

Help => General => Topic started by: Guni on February 13, 2012, 08:40:52 am

Title: Linking OpenGL to SFML projects
Post by: Guni on February 13, 2012, 08:40:52 am
I am using Visual Studio 2010 on Windows 7 Ultimate and I installed the latest snapshot of SFML 2.0 using CMake.

I did not use CMake to build the example projects, to see if I can do this myself. Pong compiles fine, but when I try building the OpenGL example, the linker complains:

1>Source.obj : error LNK2001: unresolved external symbol _gluPerspective@32
1>Source.obj : error LNK2001: unresolved external symbol _gluBuild2DMipmaps@28

Do I need to have GLUT or freeglut installed in order to use OpenGL with SFML? I was under the impression that SFML eliminate the need for those utilities. But if not, are both compatible with SFML?
Title: Linking OpenGL to SFML projects
Post by: Laurent on February 13, 2012, 08:51:00 am
Quote
Do I need to have GLUT or freeglut installed in order to use OpenGL with SFML?

No, it is only needed for the example.
Title: Linking OpenGL to SFML projects
Post by: Guni on February 13, 2012, 08:57:27 am
Thanks for the reply,

How would I initialize an OpenGL context without freeglut or GLUT otherwise, but purely using SFML?

Edit: Is it through the Window packages, after which I initialize OpenGL, I can code in OpenGL as I would if I had used another utility like freeglut or GLUT?
Title: Linking OpenGL to SFML projects
Post by: Laurent on February 13, 2012, 09:47:09 am
Quote
Is it through the Window packages, after which I initialize OpenGL, I can code in OpenGL as I would if I had used another utility like freeglut or GLUT?

Yes. Create a sf::Window and you get a valid OpenGL context.