mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
internal/graphicsdriver/opengl/gl: bug fix: failed to load OpenGL(ES).framework on iOS
This change also fixes the issue that *EXT functions are missing in OpenGLES.framework. Closes #2456
This commit is contained in:
parent
7d146fb70b
commit
0d8912e7ae
@ -16,6 +16,7 @@ package gl
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/ebitengine/purego"
|
"github.com/ebitengine/purego"
|
||||||
)
|
)
|
||||||
@ -25,12 +26,12 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (c *defaultContext) init() error {
|
func (c *defaultContext) init() error {
|
||||||
opengl = purego.Dlopen("/System/Library/Frameworks/OpenGLES.framework/Versions/Current/OpenGLES", purego.RTLD_LAZY|purego.RTLD_GLOBAL)
|
opengl = purego.Dlopen("OpenGLES.framework/OpenGLES", purego.RTLD_LAZY|purego.RTLD_GLOBAL)
|
||||||
if opengl != 0 {
|
if opengl != 0 {
|
||||||
c.isES = true
|
c.isES = true
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
opengl = purego.Dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", purego.RTLD_LAZY|purego.RTLD_GLOBAL)
|
opengl = purego.Dlopen("OpenGL.framework/OpenGL", purego.RTLD_LAZY|purego.RTLD_GLOBAL)
|
||||||
if opengl != 0 {
|
if opengl != 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -38,5 +39,11 @@ func (c *defaultContext) init() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *defaultContext) getProcAddress(name string) uintptr {
|
func (c *defaultContext) getProcAddress(name string) uintptr {
|
||||||
|
if c.isES {
|
||||||
|
const ext = "EXT"
|
||||||
|
if strings.HasSuffix(name, ext) {
|
||||||
|
name = name[:len(name)-len(ext)]
|
||||||
|
}
|
||||||
|
}
|
||||||
return purego.Dlsym(opengl, name)
|
return purego.Dlsym(opengl, name)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user