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

Author Topic: Need to get pointers to OpenGL functions manually?  (Read 1731 times)

0 Members and 1 Guest are viewing this topic.

P@u1

  • Jr. Member
  • **
  • Posts: 83
    • View Profile
Need to get pointers to OpenGL functions manually?
« on: May 10, 2011, 07:11:04 pm »
Hi,

I just tried to do some openGL with SFML and recognized some commands and keywords from openGL are not available:

Code: [Select]

glGenBuffers
GL_ARRAY_BUFFER


I am very new to OpenGL and just wanted to try some things from an tutorial. Somewhere else I read that for for openGL functions you somehow have to get pointers to these functions manually.
Is it true that SFML doesen't to that?
I this is true, how can I get acess to these functions?
Or do I maybe just need to add an include to get things working?

Thanks for your help in advance!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Need to get pointers to OpenGL functions manually?
« Reply #1 on: May 10, 2011, 07:51:52 pm »
The OpenGL library is split in two parts:
- the runtime, provided by the graphics driver
- the development files (headers and import libraries), provided by the OS

The problem is that the latter are never updated; on Windows for example, OpenGL headers & libs are still in version 1.4. So even if your graphics card supports 1.5 or 2.0 functions, they are not directly available through the headers and libs. That's why you have to load them manually.

The best way to do this is to use a library such as GLEW or GLEE: they load everything automatically so that you have almost nothing to worry about. Be careful though, functions and constants names may be different, since they are loaded as extensions instead of being part of the core library. For example, glGenBuffers becomes glGenBuffersARB.
Laurent Gomila - SFML developer