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

Author Topic: SFML needs a glGetProcAddress();  (Read 4596 times)

0 Members and 1 Guest are viewing this topic.

graphitemaster

  • Newbie
  • *
  • Posts: 18
    • View Profile
SFML needs a glGetProcAddress();
« on: October 13, 2010, 08:03:31 am »
This has been bugging me for quite some time, SFML does not have it's own variant of glGetProcAddress(), which can be really annoying at times, especially when coding minimal applications that greatly depend on the use of OpenGL extensions.

As far as I remember SDL has it's own glGetProcAddress(), and it's just a macro hack really, my game engine has its own I wrote nothing hard at all, putting this somewhere in the source, such as inside a Tools.hpp file or something could clean up 9% of SFML's platforms specific glX() and wgl() calls to get proc addresses from GL.

Pasted below is my version of a simple work around for this, note other platforms that come and go, just need their own #ifdef #endif

#ifdef WIN32
   #define glGetProcAddress(a) wglGetProcAddress(a)
#endif
#ifdef X11
   #define glGetProcAddress(a) glXGetProcAddress((const uchar*)a)
#endif

Now for those whoa re wondering about the cast, it has to be done like this because of the way X11 expects it's arguments, do note that uchar ( is a unsigned char ) I have all unsiged types typedefed in my code, because it gets repetitive writing things like:
const unsigned long:

Which would be cool if SFML did for you to, it'll make programming things for beginners a heck of a lot simpler, since they don't have to manually typedef things, note even OpenGL has it's own types, why can't SFML not?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
SFML needs a glGetProcAddress();
« Reply #1 on: October 13, 2010, 08:16:44 am »
SFML doesn't handle OpenGL extensions, there are already good libraries dedicated to this job (GLEW, GLEE).
Laurent Gomila - SFML developer

graphitemaster

  • Newbie
  • *
  • Posts: 18
    • View Profile
SFML needs a glGetProcAddress();
« Reply #2 on: October 13, 2010, 08:58:58 am »
Quote from: "Laurent"
SFML doesn't handle OpenGL extensions, there are already good libraries dedicated to this job (GLEW, GLEE).


BOTH BAD LIBRARIES, REALLY BAD LIBRARIES
GLEW, and GLEE, are the worst things anyone
could, and should ever use.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
SFML needs a glGetProcAddress();
« Reply #3 on: October 13, 2010, 09:18:31 am »
Quote from: "graphitemaster"
BOTH BAD LIBRARIES, REALLY BAD LIBRARIES
GLEW, and GLEE, are the worst things anyone
could, and should ever use.

Can you tell us why?
Laurent Gomila - SFML developer

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
SFML needs a glGetProcAddress();
« Reply #4 on: October 13, 2010, 10:10:46 pm »
I think it's out of SFML's scope.

Tuffywub

  • Newbie
  • *
  • Posts: 26
    • View Profile
    • Email
Re: SFML needs a glGetProcAddress();
« Reply #5 on: April 07, 2013, 06:42:23 pm »
I know this is an old topic, but as far as I can tell, this doesn't exist. I think it would be a great, simple feature to add. I can do it with macros too, but it would be nice if this was done internally.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML needs a glGetProcAddress();
« Reply #6 on: April 07, 2013, 07:23:59 pm »
Unless you have new arguments, my answer is still the same as above.
Laurent Gomila - SFML developer