According to this page https://support.apple.com/en-us/HT202823. My MacBook Pro (13-inch, Early 2011) with Intel HD Graphics 3000 runs OpenGL 3.3, but my code is just getting an old version (2.1). I’m using
glGetString(GL_VERSION)
to get the current OGL version that is running.
How to force my code for the last available version? I have tried GLFW_CONTEXT_VERSION_MAJOR and GLFW_CONTEXT_VERSION_MINOR.
Thanks in advance!
[QUOTE=Dunkelheit;1290559]According to this page https://support.apple.com/en-us/HT202823. My MacBook Pro (13-inch, Early 2011) with Intel HD Graphics 3000 runs OpenGL 3.3, but my code is just getting an old version (2.1). I’m using
glGetString(GL_VERSION)
to get the current OGL version that is running.
How to force my code for the last available version? I have tried GLFW_CONTEXT_VERSION_MAJOR and GLFW_CONTEXT_VERSION_MINOR.[/QUOTE]
You need
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
MacOS doesn’t support 3.0 or the compatibility profile; if you want anything above 2.1, you’re limited to the core profile.
GLFW’s defaults request a compatibility-profile context, and this takes precedence over the version: if you request 3.3 compatibility profile, and your options are either 2.1 or 3.3 core profile, you get 2.1.
Note that this makes a large number of legacy features unavailable, including fixed-function vertex and fragment processing, client-side vertex arrays, etc. That’s why GLFW makes the compatibility profile the default and taking precedence over the version. Code which wasn’t written specifically for 3+ core profile won’t work with a core profile.
@GClements
Thank you for the reply.
I have figured out how to fix that doing another way.
Every time I’m printing the version of OGL, it was printing 2.1. So I just skipped my current little project and downloaded a new one from http://www.opengl-tutorial.org. First off I had to configure CMake on mac to make it build a new Xcode project and run it again.
Now I learned a new way to show the OGL version (glfwGetVersionString):
std::cout << "#---> OGL VERSION: " << glGetString(GL_VERSION) << std::endl;
std::cout << "#---> OGL VERSION: " << glfwGetVersionString() << std::endl;
The result is:
[pre]
#—> OGL VERSION: 3.3 INTEL-10.4.14
#—> OGL VERSION: 3.1.2 Cocoa NSGL chdir menubar retina
[/pre]
Before whole this last process I have done similary what you’ve suggestion (actually before u have suggested it for me) and make some hints to force OGL try to use 3.0+ versions and it didn’t worked out for me. I coded:
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
But now checking it again I have:
glfwWindowHint(GLFW_SAMPLES, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
And both ways to get OGL version works for 3.0+ version.
Sorry for this long thread and for my english.
I have one last question, if you or someone else can answer to me. Are Versions 3.0+ compatibility for PBR and most of modern shaders? I’m new to all of these.
Thanks!