Unable to link OpenGL compatibility profile (EXT symbols not recognized) - macos

I decided to use GLEW for handling extensions instead of requesting core profile and having to migrate my code.
I would like to add support for FBO's through the EXT profile as a first step.
The problem is gcc will not link my code (OSX 10.10), it does not recognize any gl*EXT() functions. For instance, glBindFrameBufferEXT()
flags as undefined symbol. (glBindFrameBuffer() was also
unrecognized...)
I link against GLEW and have tried using GLEXT or GLFW with compatibility profile, but nothing works! Am I missing a library? How do I tell gcc to use the right GL profile? Am I obliged to migrate to core profile?

In MacOS X GLEW is not doing a lot, because there are not a lot of OpenGL extensions on MacOS X and due to the way OpenGL is integrated in MacOS X all functions of the OpenGL version supported by the available framework are immediately available
… or not, if you're using an extension function that's not supported by MacOS X's OpenGL implementation.
MacOS X is the weird duckling in the OpenGL family: OpenGL is used at a very low level in the OS's core graphics routines, to OpenGL is very well supported by the OS. But it's built so deep into the OS that it hardly can be updated without updating the whole OS.
Solution: Don't use that extension. FBOs have been introduced with OpenGL-3.3 so you've to create a 3.3 core profile context and can use the functions (without the …EXT) directly.

Related

How to enable OpenGL 3.X in Mac OS?

Previously I'm using OpenGL on Mac via glew 2.1.0 and JUCE5, but it can only access OpenGL 2.1 APIs. I can't believe that my Macbook Air (Intel Graphics) bought on 2018 can only provide this, and I'm tired to maintain two sets of API calls and shaders for 2.1 and 3.X separately. Then I tried to replace all #include <GL/glew.h> with #include <OpenGL/gl3.h>, then link with OpenGL framework directly. However, the program still failed to compile a #version 130 shader (it claims not supported).
Here I want to know that:
Does all recent Apple devices (after 2010) capable for OpenGL 3.0?
How to turn on OpenGL 3.0 support on MacOS?
Finally I found the way: I have to enable it on JUCE side. When JUCE's OpenGL context is created, I must explicitly set expected OpenGL version by setOpenGLVersionRequired( juce::OpenGLContext::openGL3_2 ) before using it.
IMPORTANT: this would still lead failure to a compile to #version 130 shader, as Apple would strictly deprecate all old features prior to specified API version. A simple workaround is to dynamically prepend a version declaration according to system type, as GLSL 1.3.0 features is mostly included by GLSL 1.5.0.

Is GLX_ARB_multisample supported by OSX

I'm trying to use glfw3 with OpenGL 3.3 (core profile) on OSX with full screen anti-alisiang via glfwWindowHint(GLFW_SAMPLES,4). My extension loader glad tells me that GLX_ARB_multisample is not supported, which is required for GLFW_SAMPLES to work.
My question is very basic: Am I doing something wrong or is multi-sampling currently not supported by glfw on OSX?
No, GLX_ARB_multisample is not supported by OSX's native GL API.
My extension loader glad tells me that GLX_ARB_multisample is not supported, which is required for GLFW_SAMPLES to work.
You are totally wrong here. GLX_ARB_multisample is an GLX extension, which is relevant for the X11 Window System, not for OSX's Cocoa/NSOpenGL APIs. OSX does support multisampling, and it is controlled via the NSOpenGLPFASamples attribute, and GLFW is using it.
If you even try to load GLX extensions on that platform, you are doing something wrong (and this is not glad's fault).

How do I upgrade my OpenGL from 2.1 to 3.3 on Mac OSX?

I am trying to program OpenGL 3 in C on my Macbook Pro.
My graphics card is NVIDIA GeForce 320M 256 MB, but I have OpenGL 2.1 According to wikipedia, I should be able to use OpenGL 3.3:
However, when I run glxinfo | grep -i opengl, I get OpenGL version string: 2.1 NVIDIA-8.24.16 310.90.9.05f01.
How do I go about upgrading it? I am running Mavericks.
Technically, you cannot get a (windowed) OpenGL 3.2 context programming purely in C on OS X.
You have to use part of Cocoa (an Objective-C framework) called NSOpenGL; AGL (deprecated C-based API) as well as the really old X server implementation (XQuartz) are perpetually limited to OpenGL 2.1.
Apple's own implementation of GLUT wraps NSOpenGL (FreeGLUT does not), and so do GLFW, SDL, etc. They have small portions that are written in Objective-C to interface with NSOpenGL and this allows them to create window-based OpenGL 3.2+ render contexts even in C software.
Now, the problem here is actually that glxinfo uses XQuartz, which does not support OpenGL 3.2+. I would suggest you use the OpenGL Extension Viewer on the Mac App store if you want detailed info about your OpenGL capabilities.
Since you're just starting out with OpenGL development on OS X, I would also suggest you have a look here for a quick overview of the various APIs.
You cannot upgrade your graphics drivers since they are provided by Apple. But your system should support OpenGL 3.3 ( https://developer.apple.com/opengl/capabilities/ ). When creating a OpenGL context you must request a CoreProfile mode. If you are using GLUT this can be done this way:
GLUT on OS X with OpenGL 3.2 Core Profile

How to do OpenGL 3 programming on OS X with a GeForce 9400

I have a MacBook Pro with a GeForce 9400 graphics card. Wikipedia said this card supports OpenGL 3.
But the header and library shipped with OS X 10.6 seems to be OpenGL 2 only (I checked the files in /usr/X11/include/).
I need to do some OpenGL 3 programming. Can I do it with my current hardware and OS? What do I need to get and install?
Sadly, I don't think you can yet, as detailed here.
I believe Lion will upgrade OpenGL to 3.2 for OS X though (which is still short of the more useful 3.3 unfortunately).
NB: I do not own a Mac, this is purely from trying to learn modern OpenGL on the windows side and digging around to understand how portable it would be.
Edit: this thread on the official OpenGL forums has more detail. Although (see comments below this answer) it may not be completely clear why vendors cannot provide OpenGL 3+ compliant drivers, it seems pretty clear that there is no way to use fully OpenGL 3.3 compliant code and shaders in OS X. Some workarounds are provided in that thread however, as well as in my first link.
The best place to check OpenGL support on the various OSX and Mac combinations is:
http://developer.apple.com/graphicsimaging/opengl/capabilities/
See the "Core" subpage for 10.7+
OpenGL 3.2 with GLSL 1.5 on 10.7.2 isn't too bad.
Your current hardware can support OpenGL 3, but not the OS. Mac OS X 10.7 (Lion) should support OpenGL 3, which is a solution only if you can wait many months.
Your only option right now is to switch to a different OS such as Windows or Linux. You'll have to boot from this other operating system, because the virtual machine systems present a virtual video card to the guest operating systems, and none have OpenGL 3 compatible virtual video cards.
(Disclaimer: This information is based on taking Windows OpenGL and replacing wgl with glX. But I did verify that the corresponding extensions exist in GLX land)
You won't find OpenGL 3 support in any header files. Rather you need the GLX_ARB_create_context extension.
The other answers are probably correct about missing support in OSX, but even when support comes, you'll have to use glXGetProcAddress and load the extension. (Can't video card manufacturers add support for these extensions through their driver? Why does it require "OS support"?)
Windows OpenGL developer here. On Windows 7 only OpenGL 1.4 is officially supported, but everyone gets around this limitation by querying which functions are available at run-time.
On OSX I expect you can do the same thing. The easiest way to do this is with The OpenGL Extension Wrangler Library: http://www.opengl.org/sdk/libs/GLEW/

Update OpenGL libraries on windows

I'm using a 3rd party DLL which uses OpenGL. Right now that 3rd party does not work correctly as the display does not refresh correctly. I came to suspect that the OpenGL library isn't correctly installed or may be outdated.
Is there a way to update the OpenGL library on windows? Is there like an official site which will hold the correct opengl.dll file or something like that?
I believe the OpenGL libraries are just part of the drivers that ship with your graphics card. Upgrading your graphics drivers should upgrade your OpenGL stuff to the latest your card supports.
OpenGL should be up to date on Windows.
However, if you are getting display/refresh problems, and they're only occuring on windows, this is most likely an issue with your graphics driver.
Try updating to your latest OpenGL graphics driver. This fixes many OpenGL issues on Windows.
opengl.dll is part of your display card driver. Windows comes with a default opengl.dll that offers very little acceleration. Re installing the graphics card driver or upgrading to the latest version should take care of your problem.
OpenGL is implemented in the graphics driver. If you want to use the latest OpenGL version as a developer you download and use GLEW (http://glew.sourceforge.net/) as a normal library. This will give you access to cross platform OpenGL 4.1 or whatever version your card supports.

Resources