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

Author Topic: Issues with SFML/OpenGL.hpp on Mac OS  (Read 4823 times)

0 Members and 1 Guest are viewing this topic.

unlight

  • Newbie
  • *
  • Posts: 33
    • View Profile
    • Email
Issues with SFML/OpenGL.hpp on Mac OS
« on: January 14, 2017, 01:20:52 am »
Hi guys,

I am new to SFML and have come across an issue and would like some advice on how to report it, or find out if it is already a known issue.

I have been trying to use the SFML/OpenGL.hpp header to access openGL function calls on a MacBook. However, this header file does not give me access to the standard OpenGL functions for generating or binding/unbinding vertex arrays, instead I am provided with Apple-specific versions of those functions as shown below:

glGenVertexArrays(GLsizei n, GLuint *arrays)  --->  glGenVertexArraysAPPLE(GLsizei n, GLuint *ids)
glBindVertexArray(GLuint array)  --->  glBindVertexArrayAPPLE(GLuint id)

After some research and experimentation on the subject, I found the cause of this to be the inclusion of a header file within the SFML/OpenGL.hpp header:

.....
#elif defined(SFML_SYSTEM_MACOS)
    #include <OpenGL/gl.h>
.....

This header file I believe should actually be replaced with:

#include <OpenGL/gl3.h>

As I mentioned before, I am new to SFML and OpenGL so I may very well be wrong here, all I know is that if I include the above header file, I get access to the standard OpenGL functions to generate and bind vertex arrays. Using the Apple specific ones mentioned earlier result in my calls to glDrawArrays failing to render (no error messages), but using the above header and the standard vertex array functions fixes this problem.

If anyone has any advice on how I could further this issue, or if I am wrong in some way, I would appreciate your time.

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Issues with SFML/OpenGL.hpp on Mac OS
« Reply #1 on: January 14, 2017, 04:15:23 pm »
As you know, SFML graphics module works exclusively with 2.1 context on Mac. doc

That being said, if you don't need the graphics module you could follow the instruction here to include the proper function declarations.

It's probably better to leave the include in OpenGL.hpp as is until SFML is upgraded to use more modern OpenGL code. Duplicating & updating this file in your own codebase is a viable solution I think.
SFML / OS X developer

unlight

  • Newbie
  • *
  • Posts: 33
    • View Profile
    • Email
Re: Issues with SFML/OpenGL.hpp on Mac OS
« Reply #2 on: January 15, 2017, 01:50:03 am »
Thank you for the reply, I'll use this solution until SFML upgrades naturally.

 

anything