Просмотр исходного кода

Set OpenGLForwardCompatible window hint only for OSX.

leonsal 8 лет назад
Родитель
Сommit
54e9403815
1 измененных файлов с 9 добавлено и 0 удалено
  1. 9 0
      window/glfw.go

+ 9 - 0
window/glfw.go

@@ -5,6 +5,8 @@
 package window
 
 import (
+	"runtime"
+
 	"github.com/g3n/engine/core"
 	"github.com/go-gl/glfw/v3.2/glfw"
 )
@@ -49,6 +51,13 @@ func newGLFW(width, height int, title string, full bool) (*GLFW, error) {
 		glfw.WindowHint(glfw.ContextVersionMinor, 3)
 		glfw.WindowHint(glfw.OpenGLProfile, glfw.OpenGLCoreProfile)
 		glfw.WindowHint(glfw.Samples, 8)
+		// Sets OpenGL forward compatible context only for OSX because it is required for OSX.
+		// When this is set glLineWidth(width) only accepts width=1.0 and generates error
+		// for any other values although the spec says it should ignore non supported widths
+		// and generate error only when width <= 0.
+		if runtime.GOOS == "darwin" {
+			glfw.WindowHint(glfw.OpenGLForwardCompatible, glfw.True)
+		}
 		initialized = true
 	}