Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


OpenGL 4.x and OS X Mountain Lion


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
9 replies to this topic

#1 Neosettler   Members   -  Reputation: 150

Like
0Likes
Like

Posted 15 December 2012 - 12:55 PM

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.

Edited by Neosettler, 15 December 2012 - 12:56 PM.


Sponsor:

#2 Erik Rufelt   Crossbones+   -  Reputation: 3506

Like
1Likes
Like

Posted 15 December 2012 - 02:48 PM

There's only 3.2 on OS X. https://developer.apple.com/graphicsimaging/opengl/capabilities/

#3 TheChubu   Crossbones+   -  Reputation: 4548

Like
0Likes
Like

Posted 15 December 2012 - 02:51 PM

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

Edited by TheChubu, 15 December 2012 - 02:51 PM.

"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


#4 Neosettler   Members   -  Reputation: 150

Like
0Likes
Like

Posted 15 December 2012 - 10:20 PM

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.

Edited by Neosettler, 15 December 2012 - 10:21 PM.


#5 Yours3!f   Members   -  Reputation: 1382

Like
0Likes
Like

Posted 16 December 2012 - 02:49 AM

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)

#6 Neosettler   Members   -  Reputation: 150

Like
0Likes
Like

Posted 17 December 2012 - 05:01 PM

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?

Edited by Neosettler, 17 December 2012 - 05:02 PM.


#7 bioglaze   Members   -  Reputation: 588

Like
0Likes
Like

Posted 18 December 2012 - 05:24 AM

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.

#8 Neosettler   Members   -  Reputation: 150

Like
0Likes
Like

Posted 18 December 2012 - 11:10 AM

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

Edited by Neosettler, 18 December 2012 - 11:12 AM.


#9 Aldacron   GDNet+   -  Reputation: 3230

Like
0Likes
Like

Posted 19 December 2012 - 02:11 AM

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.

#10 Nyssa   Members   -  Reputation: 426

Like
0Likes
Like

Posted 21 December 2012 - 10:49 AM

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.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS