fix opengl init

This commit is contained in:
Alex Yatskov 2019-01-05 12:20:12 -08:00
parent cb5202f7c4
commit 45f68bcec7
2 changed files with 5 additions and 6 deletions

View File

@ -5,7 +5,6 @@ import (
"runtime" "runtime"
"github.com/FooSoft/lazarus/math" "github.com/FooSoft/lazarus/math"
"github.com/go-gl/gl/v2.1/gl"
"github.com/veandco/go-sdl2/sdl" "github.com/veandco/go-sdl2/sdl"
) )
@ -46,11 +45,6 @@ func NewWindow(title string, size math.Vec2i, scene Scene) (*Window, error) {
sdl.GLSetAttribute(sdl.GL_CONTEXT_MINOR_VERSION, 1) sdl.GLSetAttribute(sdl.GL_CONTEXT_MINOR_VERSION, 1)
sdl.GLSetAttribute(sdl.GL_DOUBLEBUFFER, 1) sdl.GLSetAttribute(sdl.GL_DOUBLEBUFFER, 1)
log.Println("opengl global init")
if err := gl.Init(); err != nil {
return nil, err
}
singleton.sdlIsInit = true singleton.sdlIsInit = true
} }

View File

@ -44,6 +44,11 @@ func newWindow(title string, size math.Vec2i, scene Scene) (*Window, error) {
w.makeCurrent() w.makeCurrent()
log.Println("opengl init")
if err := gl.Init(); err != nil {
return nil, err
}
w.imguiContext, err = imgui.New(w.DisplaySize(), w.BufferSize()) w.imguiContext, err = imgui.New(w.DisplaySize(), w.BufferSize())
if err != nil { if err != nil {
w.Destroy() w.Destroy()