remove orphan functions from pixelgl (use OpenGL directly instead)

This commit is contained in:
faiface 2016-12-03 15:38:33 +01:00
parent 26c44125cf
commit a3e7656922
2 changed files with 8 additions and 24 deletions

View File

@ -1,20 +0,0 @@
package pixelgl
import "github.com/go-gl/gl/v3.3-core/gl"
// This file defines functions that can operate without a parent Doer.
// Clear clears the current OpenGL context.
func Clear(r, g, b, a float32) {
DoNoBlock(func() {
gl.ClearColor(r, g, b, a)
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

@ -5,6 +5,7 @@ import (
"sync" "sync"
"github.com/faiface/pixel/pixelgl" "github.com/faiface/pixel/pixelgl"
"github.com/go-gl/gl/v3.3-core/gl"
"github.com/go-gl/glfw/v3.2/glfw" "github.com/go-gl/glfw/v3.2/glfw"
"github.com/pkg/errors" "github.com/pkg/errors"
) )
@ -128,7 +129,10 @@ func (w *Window) Delete() {
// Clear clears the window with a color. // Clear clears the window with a color.
func (w *Window) Clear(c color.Color) { func (w *Window) Clear(c color.Color) {
w.Do(func(pixelgl.Context) { w.Do(func(pixelgl.Context) {
pixelgl.Clear(colorToRGBA(c)) pixelgl.DoNoBlock(func() {
gl.ClearColor(colorToRGBA(c))
gl.Clear(gl.COLOR_BUFFER_BIT)
})
}) })
} }
@ -141,10 +145,10 @@ func (w *Window) Update() {
} }
w.window.SwapBuffers() w.window.SwapBuffers()
glfw.PollEvents() glfw.PollEvents()
})
w, h := w.window.GetSize() w, h := w.window.GetSize()
pixelgl.SetViewport(0, 0, int32(w), int32(h)) gl.Viewport(0, 0, int32(w), int32(h))
})
}) })
} }