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

Author Topic: OpenGL with SFML (dumb question)  (Read 3415 times)

0 Members and 1 Guest are viewing this topic.

pighead10

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
    • Hog Pog
OpenGL with SFML (dumb question)
« 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'
Immortui - Zombie puzzle game: http://immortui.hogpog.co.uk

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
OpenGL with SFML (dumb question)
« Reply #1 on: December 22, 2011, 07:26:08 pm »
You must include the OpenGL headers.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

pighead10

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
    • Hog Pog
OpenGL with SFML (dumb question)
« Reply #2 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.
Immortui - Zombie puzzle game: http://immortui.hogpog.co.uk

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
OpenGL with SFML (dumb question)
« Reply #3 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.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

pighead10

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
    • Hog Pog
OpenGL with SFML (dumb question)
« Reply #4 on: December 22, 2011, 07:44:24 pm »
Okay, so i need to include the opengl headers separately now.
Immortui - Zombie puzzle game: http://immortui.hogpog.co.uk

pighead10

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
    • Hog Pog
OpenGL with SFML (dumb question)
« Reply #5 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.
Immortui - Zombie puzzle game: http://immortui.hogpog.co.uk

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
OpenGL with SFML (dumb question)
« Reply #6 on: December 22, 2011, 08:17:52 pm »
Code: [Select]
#include <SFML/OpenGL.hpp>
Laurent Gomila - SFML developer

pighead10

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
    • Hog Pog
OpenGL with SFML (dumb question)
« Reply #7 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?
Immortui - Zombie puzzle game: http://immortui.hogpog.co.uk

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
OpenGL with SFML (dumb question)
« Reply #8 on: December 23, 2011, 12:25:04 pm »
On Windows, you have to link OpenGL32.lib.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

pighead10

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
    • Hog Pog
OpenGL with SFML (dumb question)
« Reply #9 on: December 23, 2011, 06:04:43 pm »
Linking that solves most linker errors except:

main.obj : error LNK2001: unresolved external symbol _gluPerspective@32
Immortui - Zombie puzzle game: http://immortui.hogpog.co.uk

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
OpenGL with SFML (dumb question)
« Reply #10 on: December 23, 2011, 06:26:12 pm »
This one is from GLU (glu32.lib).
Laurent Gomila - SFML developer