go-gl / gl

Go bindings for OpenGL (generated via glow)
MIT License
1.07k stars 74 forks source link

Error creating window on OS X 10.12.5 #79

Closed dobegor closed 6 years ago

dobegor commented 7 years ago

Hi!

When creating window using win, err := window.New("glfw", 800, 600, "Hello G3N", false) it returns an error:

VersionUnavailable: NSGL: The targeted version of OS X only supports forward-compatible contexts for OpenGL 3.2 and above

I am using v3.3-core, and I assume 3.3 is above 3.2 and this error is kind of strange.

Any way to fix this?

dmitshur commented 7 years ago

I am using v3.3-core

Do you mean you're importing that package? Did set actually set those hints before creating window?

See here for example.

drgomesp commented 7 years ago

I have the same exact issue.

dmitshur commented 7 years ago

Does the cube example work for you?

dobegor commented 7 years ago

@shurcooL Sorry, I referred to GL erroneously, I meant GLFW 3.2. Adding this to initialization sequence:

glfw.WindowHint(glfw.OpenGLForwardCompatible, glfw.True)

helped to launch correctly.

However, there are some other rendering glitches on macOS, which don't happen on Windows/Linux. Please, see this issue for details: https://github.com/g3n/engine/issues/19

Cube example works perfectly.

cjburkey01 commented 6 years ago

Here, use these window hints:

glfw.WindowHint(glfw.ContextVersionMajor, 3)
glfw.WindowHint(glfw.ContextVersionMinor, 3)
glfw.WindowHint(glfw.Resizable, glfw.True)
glfw.WindowHint(glfw.OpenGLProfile, glfw.OpenGLCoreProfile)
glfw.WindowHint(glfw.OpenGLForwardCompatible, glfw.True)

It's a GLFW + Mac thing, happens with LWJGL too.

errcw commented 6 years ago

(Closing from inactivity, hopefully the last comment resolved.)