fix window viewport

This commit is contained in:
faiface 2016-12-03 02:02:52 +01:00
parent c1e2968d2a
commit 26c44125cf
2 changed files with 10 additions and 0 deletions

View File

@ -11,3 +11,10 @@ func Clear(r, g, b, a float32) {
gl.Clear(gl.COLOR_BUFFER_BIT) gl.Clear(gl.COLOR_BUFFER_BIT)
}) })
} }
// SetViewport sets the OpenGL viewport.
func SetViewport(x, y, w, h int32) {
DoNoBlock(func() {
gl.Viewport(x, y, w, h)
})
}

View File

@ -142,6 +142,9 @@ func (w *Window) Update() {
w.window.SwapBuffers() w.window.SwapBuffers()
glfw.PollEvents() glfw.PollEvents()
}) })
w, h := w.window.GetSize()
pixelgl.SetViewport(0, 0, int32(w), int32(h))
}) })
} }