mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
internal/graphicsdriver/opengl/gl: load OpenGLES.framework if possible on Darwin
Closes #2449
This commit is contained in:
parent
b6ed95750b
commit
78f8ddbda8
@ -12,25 +12,14 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build android || ios || opengles
|
||||
//go:build android || opengles
|
||||
|
||||
package gl
|
||||
|
||||
// #cgo !darwin CFLAGS: -Dos_notdarwin
|
||||
// #cgo darwin CFLAGS: -Dos_darwin
|
||||
// #cgo !android,!darwin pkg-config: glesv2
|
||||
// #cgo android LDFLAGS: -lGLESv2
|
||||
// #cgo darwin LDFLAGS: -framework OpenGLES
|
||||
//
|
||||
// #if defined(os_darwin)
|
||||
// #define GLES_SILENCE_DEPRECATION
|
||||
// #include <OpenGLES/ES2/glext.h>
|
||||
// #endif
|
||||
//
|
||||
// #if defined(os_notdarwin)
|
||||
// #include <GLES2/gl2.h>
|
||||
// #endif
|
||||
// #cgo !android pkg-config: glesv2
|
||||
// #cgo android LDFLAGS: -lGLESv2
|
||||
//
|
||||
// #include <GLES2/gl2.h>
|
||||
// #include <stdlib.h>
|
||||
import "C"
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build (darwin || windows) && !ios && !opengles
|
||||
//go:build darwin || windows
|
||||
|
||||
package gl
|
||||
|
||||
|
@ -7,7 +7,15 @@ import (
|
||||
"github.com/ebitengine/purego"
|
||||
)
|
||||
|
||||
var opengl = purego.Dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", purego.RTLD_GLOBAL)
|
||||
var opengl uintptr
|
||||
|
||||
func init() {
|
||||
opengl = purego.Dlopen("/System/Library/Frameworks/OpenGLES.framework/Versions/Current/OpenGLES", purego.RTLD_GLOBAL)
|
||||
if opengl != 0 {
|
||||
return
|
||||
}
|
||||
opengl = purego.Dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", purego.RTLD_GLOBAL)
|
||||
}
|
||||
|
||||
func getProcAddress(name string) uintptr {
|
||||
return purego.Dlsym(opengl, name)
|
||||
|
Loading…
Reference in New Issue
Block a user