// NewOpenGlWindow tries to initialize the OpenGL environment and returns a // new window instance. func NewOpenGlWindow() (window *OpenGlWindow, err error) { if err = glfw.Init(); err == nil { glfw.WindowHint(glfw.ClientAPI, glfw.OpenGLAPI) glfw.WindowHint(glfw.ContextVersionMajor, 3) glfw.WindowHint(glfw.ContextVersionMinor, 2) glfw.WindowHint(glfw.OpenGLProfile, glfw.OpenGLCoreProfile) glfw.WindowHint(glfw.OpenGLForwardCompatible, glfw.True) var glfwWindow *glfw.Window glfwWindow, err = glfw.CreateWindow(320, 200, "shocked", nil, nil) if err == nil { glfwWindow.MakeContextCurrent() window = &OpenGlWindow{ AbstractOpenGlWindow: env.InitAbstractOpenGlWindow(), glfwWindow: glfwWindow, glWrapper: NewOpenGl()} glfwWindow.SetCursorPosCallback(window.onCursorPos) glfwWindow.SetMouseButtonCallback(window.onMouseButton) glfwWindow.SetScrollCallback(window.onMouseScroll) } } return }