OpenGL 4.x and OS X Mountain Lion

Started by
8 comments, last by Helo7777 11 years, 3 months ago
Greetings,

I’m looking for a solution to load GL extensions manually on Mac OS X without the need of a library like Glew.

On Windows I use:#include <windows.h>
#include <glcorearb.h>
LoadLibraryA("opengl32.dll");
GetProcAddress

…and it works beautifully.

On Linux I use:#include <GL/glx.h>
#include <glcorearb.h>
install libX11-dev
link to X11 lib
glXGetProcAddress

…and the world is a wonderful place.

Now, afaik, glx doesn’t support context above version 2.1 on OS X and I’m trying to find a solution but I’m not sure which direction to take. I’m already digging into XQuartz but I can’t find any relevant example how to create a 4.x context so far.

To help me in my decision making, here is a few questions that could clear things up a bit:

1 - What is the most up to date technique to use OpenGL 4.x on Linux and OS X?
2 - Is there a common way to use OpenGL 4.x between Linux and OS X?
3 - With distribution in mind, is there a way to gather GL dependencies within the API root folder? Think of this as running a GL API on a vanilla OS without the need of installing anything.

Any help would be greatly appreciated.
Advertisement
There's only 3.2 on OS X. https://developer.apple.com/graphicsimaging/opengl/capabilities/
As far as I'm aware, you only get OpenGL 3.2 in OSX.

The thing is, Apple provides the video drivers for its OS, so you get what they want to implement only. Currently, up to OpenGL 3.2.

EDIT: Ninja'd :D

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

My journals: dustArtemis ECS framework and Making a Terrain Generator

I guess 3.2 will do just fine...

I'm confused, is there another graphic hardware-accelerated library beside OpenGL on OSX?

If my understanding is correct, all we really need from the OSes is to create function pointers to interact with the GPU. What am I missing?

What about the methodology itself, any hints on implementing the latest OpenGL capabilities? I'm asking because I'd like to avoid a GLX legacy pitfall again and stick with whatever the future of OpenGL might be on OSX.

I guess 3.2 will do just fine...

I'm confused, is there another graphic hardware-accelerated library beside OpenGL on OSX?

If my understanding is correct, all we really need from the OSes is to create function pointers to interact with the GPU. What am I missing?

What about the methodology itself, any hints on implementing the latest OpenGL capabilities? I'm asking because I'd like to avoid a GLX legacy pitfall again and stick with whatever the future of OpenGL might be on OSX.


well, imo glew is awesome, saved me from some headaches... but if you don't want to use it:
on win & linux all you need to do is get the function pointers (just like glew does)
on osx same thing, except the driver WILL NOT provide you with the function pointers beyond 3.2. Which means that there's no way you could get 4.x functionality.
The exception would be if you wrote your own graphics driver to support 4.x functionality, but I doubt you either have the skills or time or will to do so. (Neither do I)
Alright, thank you for your inputs guys but I'm still clueless on which library to use... there seem to be several possible directions to take but the first one a picked led me to a dead end.

Any Jedi master could help clear this up? Which library is considered as prime development on OSX, OpenGL, Carbon, Cocoa, XCode, GLX, X11 or XQuartz? libraries... frameworks?

Alright, thank you for your inputs guys but I'm still clueless on which library to use.

I'm using gl3w and GLFW to get OpenGL 3.2 Core Profile contexxt.

Aether3D Game Engine: https://github.com/bioglaze/aether3d

Blog: http://twiren.kapsi.fi/blog.html

Control

Well, as a matter of fact, gl3w uses GLX on OSX. I've been inspired by it in my current development and I'm trying to push it to the next level, without the need of another lib except from loading function pointers but I'm hitting a wall with OSX so far.

still digging, I'll look at GLFW
On OSX, you can use dlopen and dlsym to dynamically load all OpenGL API functions the drivers expose. This is the way it's done in my D binding to OpenGL. I don't know if that's the canonical or documented way to do it, but that bit was added to the binding by a Mac developer years ago.

I would recommend, however, that you not use GetProcAddress on Windows to load anything above OpenGL 1.1. According to all of the documentation I've ever read on the subject, that is not guaranteed to work. The right approach to take is to use GetProcAddress for everything up to 1.1, then after a context has been created you use wglGetProcAddress to pull in everything else. It might work just fine on recent versions of Windows, but on older versions with older drivers you're likely asking for trouble.

I've been using XCode 4 with OGL in my projects. In XCode I just link "OpenGL.framework" then the API functions are exposed and ready to use, no need for wglGetProcAddress() like in windows.

Beware that using OGL from scratch (without GLEW etc...) on the mac can be a little trick and frustrating to do as there are only a few examples to find. The mac developer library is a good place to start. Here's the link is you want to go down that route.

And as others have stated previously, OSX only supports 3.2. And I don't think apple have plans to change that anytime soon unfortunately. This version on the mac will probably do most things you want though, if there was not a core function I was after, there was normally an ARB functions there that did the job.

This topic is closed to new replies.

Advertisement