diff --git a/run.go b/run.go index 50ae2a589eebb0ac33e6eed792aa29188e756d73..343b92bfccb46af99c8fbae8596ece3e7cf97952 100644 --- a/run.go +++ b/run.go @@ -3,7 +3,6 @@ package pixel import ( "github.com/faiface/pixel/pixelgl" "github.com/go-gl/glfw/v3.2/glfw" - "github.com/pkg/errors" ) // Run is essentialy the "main" function of Pixel. It exists mainly due to the technical limitations of OpenGL and operating systems, @@ -24,14 +23,7 @@ import ( // // You can spawn any number of goroutines from you run function and interact with Pixel concurrently. // The only condition is that the Run function must be called from your main function. -func Run(run func()) error { - err := glfw.Init() - if err != nil { - return errors.Wrap(err, "failed to initialize GLFW") - } +func Run(run func()) { defer glfw.Terminate() - pixelgl.Run(run) - - return nil } diff --git a/window.go b/window.go index 723c05d0821d1e1be51f836fad9630e9d3353f97..7e23ecf98690e31c3fe19fc3651b9bb49ad97fb8 100644 --- a/window.go +++ b/window.go @@ -73,6 +73,8 @@ func NewWindow(config WindowConfig) (*Window, error) { w := &Window{config: config} err := pixelgl.DoErr(func() error { + glfw.Init() + glfw.WindowHint(glfw.ContextVersionMajor, 3) glfw.WindowHint(glfw.ContextVersionMinor, 3) glfw.WindowHint(glfw.OpenGLProfile, glfw.OpenGLCoreProfile)