hajimehoshi / ebiten

Ebitengine - A dead simple 2D game engine for Go
https://ebitengine.org
Apache License 2.0
11.01k stars 660 forks source link

internal/graphicsdriver/opengl/gl: dynamic load of function pointers for Android #2450

Closed hajimehoshi closed 1 year ago

hajimehoshi commented 1 year ago

What feature would you like to be added?

Now GLES functions are called directly via Cgo. Load the function pointers like what internal/graphicsdriver/opengl/gl does.

Related: #2449

Why is this needed?

n/a

hajimehoshi commented 1 year ago

If purego supports Linux, this would change the situation.

hajimehoshi commented 1 year ago

Resolve #2451 first.

TotallyGamerJet commented 1 year ago

My draft PR to support Linux in purego is almost done. The only outstanding issue is requiring the internal linker. #66

hajimehoshi commented 1 year ago

Thank you for notifying it!

hajimehoshi commented 1 year ago

Apparently GLES requires EGL (https://github.com/libsdl-org/SDL/blob/120c76c84bbce4c1bfed4e9eb74e10678bd83120/src/video/x11/SDL_x11opengles.h#L40) so the situation is more complicated than I thought 🤔

hajimehoshi commented 1 year ago

This is not directly related, but I'd like to remove go-gl/glfw to reduce external dependencies. Currently, go-gl/glfw links libraries: https://github.com/go-gl/glfw/blob/93cebf72946bdd130bbda47817ad53315d776ca7/v3.3/glfw/build.go

TotallyGamerJet commented 1 year ago

Why don't you want to link to them and instead dlopen the correct one? Is it because initialization of all of them takes time?

hajimehoshi commented 1 year ago

Why don't you want to link to them and instead dlopen the correct one? Is it because initialization of all of them takes time?

I don't want to do that since this would make it a little difficult to cross-compile Ebitengine.

hajimehoshi commented 1 year ago

Now GLES functions are called directly via Cgo.

This was already resolved for Linux and FreeBSD. Android has this issue, but I'm not sure I can resolve this.