mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
internal/graphicsdriver/opengl: bug fix: initialization was too early on Windows
Closes #2452
This commit is contained in:
parent
b536b82109
commit
f69beffc6c
@ -82,9 +82,18 @@ func getProgramID(p program) programID {
|
||||
}
|
||||
|
||||
type contextImpl struct {
|
||||
init bool
|
||||
}
|
||||
|
||||
func (c *context) reset() error {
|
||||
if !c.init {
|
||||
// Initialize OpenGL after WGL is initialized especially for Windows (#2452).
|
||||
if err := gl.Init(); err != nil {
|
||||
return err
|
||||
}
|
||||
c.init = true
|
||||
}
|
||||
|
||||
c.locationCache = newLocationCache()
|
||||
c.lastTexture = invalidTexture
|
||||
c.lastFramebuffer = invalidFramebuffer
|
||||
|
@ -20,7 +20,6 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver"
|
||||
"github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver/opengl/gl"
|
||||
"github.com/hajimehoshi/ebiten/v2/internal/microsoftgdk"
|
||||
)
|
||||
|
||||
@ -31,8 +30,5 @@ func NewGraphics() (graphicsdriver.Graphics, error) {
|
||||
return nil, fmt.Errorf("opengl: OpenGL is not supported on Xbox")
|
||||
}
|
||||
g := &Graphics{}
|
||||
if err := gl.Init(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return g, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user