Compiling gl4es?
Hello! I am looking to compile gl4es with Cheerp. I am aware of the already compiled binary in the Browsercraft project, however I am looking to compile it on my own so that I can maintain it if needed (Eventually I will need to also build LWJGL myself but I'll worry about that when I get there). When I try to build the gl4es repo with the latest Cheerp version, I get an error about the platform not being recognized and 3 errors about unknown types, all relating to EGL. How might I go about compiling this myself?
GitHub
GitHub - ptitSeb/gl4es: GL4ES is a OpenGL 2.1/1.5 to GL ES 2.0/1.1 ...
GL4ES is a OpenGL 2.1/1.5 to GL ES 2.0/1.1 translation library, with support for Pandora, ODroid, OrangePI, CHIP, Raspberry PI, Android, Emscripten and AmigaOS4. - ptitSeb/gl4es
7 Replies
I do in fact intend to run Minecraft with this, however I have multiple other projects of mine that might be cool to see in the browser, and having this would make things easier, so I've kept it out of the #browsercraft channel since it has more potential than just Minecraft.
For the immediate issue of the unrecognized platform, try to pass
-DCMAKE_C_FLAGS="-DUSE_X11"
to cmake.
But in order to compile gl4es you also need to compile the X11 libraries, and link with an EGL implementation.
And you need a very basic X server on the other side to display the window.
This is all doable (we did this for browsercraft) but it's non-trivial work.
You are welcome to experiment and ask questions, I just want to set the correct expectations.
We are also actively working in making all of this easier to do, and publish many of the currently unreleased components in the near future.I am currently away from my development setup, but I will be taking notes for reference when I return to it in a couple of hours. Currently, here are my steps that (I think) will work.
1. Compile EGL from Mesa using Cheerp.
2. Compile X11.
3. Build gl4es.
That is just what I think for now. I have never compiled EGL or X11, so I have no idea what the dependencies are or how it will go.
I don't expect it to be an easy process. The feat of running Minecraft in the browser doesn't seem like an easy task.
I'll get to my setup in ~50m, so when I get there I'll start compiling. After looking, I believe I need to actually build Xlib first. If I'm correct. I'll need to resolve dependencies required by Xlib, then compile and add Xlib to the toolchain. After that, I'll configure a build of Mesa EGL with OpenGL disabled, GLES2 enabled, and X11 support. If I am correct, then I will be set to continue with the gl4es build after that.
The steps are reasonable with exception of EGL. This cannot truly be compiled and needs to be provided by the platform.
CheerpJ provides it, and it in the future we plan to provide an implementation as part of the CheerpOS target of Cheerp
This is not yet released though
That poses a problem then. Assuming CheerpJ's EGL implementation is a shared library, would it be possible to downlaod it from my browser cache and put it into my toolchain?
That won't work since the library depends on "kernel" side functionality exposed internally by CheerpJ. Beside this it would not be allowed by the licensing.
You might be able to implement your own version using Cheerp. Implementing X11 is the biggest challenges.
As Yuri mentioned these infrastructure will be available as part of CheerpOS. We have implemented the technology originally for CheerpJ, but down the line CheerpJ will use CheerpOS as well.
If your final interest is to work on top of the LWJGL, my recommendation is to use the modules we pre-compiled for browsercraft
(Apologies for not a previous not coherent version of this reply)
All good. It is a shame I will be unable to compile it myself, but I can use the pre-compiled modules for the time being.
I plan to (eventually) have a complete Minecraft launcher in the browser, so as CheerpJ supports more, then I will be able to add more.
I greatly appreciate the support given here. Thank you for the information.