mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 11:18:54 +01:00
uidriver/glfw: Set No-API when creating a hidden window first
GLFW tries to create an OpenGL context by default when creating a window. This is not necessary when OpenGL is not used. This is an optimization by skipping to create an OpenGL context if possible.
This commit is contained in:
parent
8369a4cc15
commit
3eaa7dd0e1
@ -97,6 +97,7 @@ const (
|
||||
CursorHidden = 0x00034002
|
||||
CursorNormal = 0x00034001
|
||||
NoAPI = 0
|
||||
OpenGLAPI = 0x00030001
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -130,6 +130,7 @@ func initialize() error {
|
||||
return err
|
||||
}
|
||||
glfw.WindowHint(glfw.Visible, glfw.False)
|
||||
glfw.WindowHint(glfw.ClientAPI, glfw.NoAPI)
|
||||
|
||||
// Create a window to set the initial monitor.
|
||||
w, err := glfw.CreateWindow(16, 16, "", nil, nil)
|
||||
@ -660,6 +661,7 @@ func (u *UserInterface) run() error {
|
||||
u.window = nil
|
||||
|
||||
if u.Graphics().IsGL() {
|
||||
glfw.WindowHint(glfw.ClientAPI, glfw.OpenGLAPI)
|
||||
glfw.WindowHint(glfw.ContextVersionMajor, 2)
|
||||
glfw.WindowHint(glfw.ContextVersionMinor, 1)
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user