SFML community forums

Help => General => Topic started by: pighead10 on December 22, 2011, 07:24:11 pm

Title: OpenGL with SFML (dumb question)
Post by: pighead10 on December 22, 2011, 07:24:11 pm
dumb question: do I have to download something extra to use OpenGL with SFML? I try to use OpenGL code like

Code: [Select]
glClearDepth(1.f);

in my project following 1.6 tutorials with 2.0 but I just get 'identifier is undefined'
Title: OpenGL with SFML (dumb question)
Post by: Groogy on December 22, 2011, 07:26:08 pm
You must include the OpenGL headers.
Title: OpenGL with SFML (dumb question)
Post by: pighead10 on December 22, 2011, 07:27:48 pm
I have SFML/Window.hpp included, which in the tutorial it says includes the opengl headers as well.
Title: OpenGL with SFML (dumb question)
Post by: Groogy on December 22, 2011, 07:30:39 pm
Well this is not 1.6 now is it? Despite that, it's a bad practice to ignore includes just because you expect another to include it for you.
Title: OpenGL with SFML (dumb question)
Post by: pighead10 on December 22, 2011, 07:44:24 pm
Okay, so i need to include the opengl headers separately now.
Title: OpenGL with SFML (dumb question)
Post by: pighead10 on December 22, 2011, 08:03:53 pm
Um - what are the headers for opengl? I tried

Code: [Select]
#include <GL/gl.h>
#include <GL/glu.h>

but it came up with a ton of compiler errors.
Title: OpenGL with SFML (dumb question)
Post by: Laurent on December 22, 2011, 08:17:52 pm
Code: [Select]
#include <SFML/OpenGL.hpp>
Title: OpenGL with SFML (dumb question)
Post by: pighead10 on December 23, 2011, 12:22:35 pm
I get linker errors with openGL functions when using the opengl code. What library directories do I need to include?
Title: OpenGL with SFML (dumb question)
Post by: Nexus on December 23, 2011, 12:25:04 pm
On Windows, you have to link OpenGL32.lib.
Title: OpenGL with SFML (dumb question)
Post by: pighead10 on December 23, 2011, 06:04:43 pm
Linking that solves most linker errors except:

main.obj : error LNK2001: unresolved external symbol _gluPerspective@32
Title: OpenGL with SFML (dumb question)
Post by: Laurent on December 23, 2011, 06:26:12 pm
This one is from GLU (glu32.lib).