LWJGL / lwjgl3-demos

Demo suite for LWJGL 3
BSD 3-Clause "New" or "Revised" License
351 stars 89 forks source link

Add support for OS X #18

Closed monarezio closed 6 years ago

monarezio commented 6 years ago

Hi,

Some of your examples, do require a higher OpenGL version. I think it would be handy if you added theese lines of code to support OS X users, and force the OS to run OpenGL 3.0 or higher!

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)
httpdigest commented 6 years ago

I don't know which demos you mean. All demos that do require a >=3.2 context have appropriate context version flags. Can you name the demos you mean?

monarezio commented 6 years ago

https://github.com/LWJGL/lwjgl3-demos/blob/master/src/org/lwjgl/demo/opengl/textures/Texture2DArrayMipmapping.java

It crashes everytime I try to run with the following description: NSGL: The targeted version of macOS does not support OpenGL 3.0 or 3.1 but may support 3.2 and above

I tried adding:

glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE)
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE)

And it also crashed with: Context profiles are only defined for OpenGL version 3.2 and above

I new/trying to learn OpenGL and LWJGL3, so it would take me longer time to fix this, I suppose, than you.

monarezio commented 6 years ago

If I force OpenGL 3 by:

glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);

The shaders crash with the message: version '130' is not supported

So I set the version v the shaders on 400 and I get the window opened, showing only on quater of the screen. I am not sure if it is the expected result.

screen shot 2018-07-06 at 07 07 17
httpdigest commented 6 years ago

Thanks for the info!

I new/trying to learn OpenGL and LWJGL3, so it would take me longer time to fix this, I suppose, than you.

I am afraid not. :) I do not have a Mac so I rely on other people to test and figure things out until it works on OS X.

httpdigest commented 6 years ago

I've done some changes regarding using OpenGL 3.2 Core (forward-compatible) when 3.0 was used, and to fix resolution issues with retina displays. Can you please check whether it works? See: https://github.com/LWJGL/lwjgl3-demos/commit/037502c37cbd1c8eff2de1bf48b6f9228abc7edf

monarezio commented 6 years ago

Great it worked, Thanks!