Open vanfanel opened 4 years ago
It largely depends on how the KMSDRM backend is implemented in SDL2. I haven't looked into it too much, but in general if it's possible to create an OpenGL 3.3 context then it won't be too hard to do. Otherwise, I'd need to do some refactoring to abstract the renderer, which would be a bit more work.
This is definitely going on my to-do list though!
@mdodis Thing is, I did part of the KMSDRM backen on SDL2! You can create both OpenGL and OpenGL_ES2 contexts from it. In fact, SDL2 does this for you, you simply have to as for an OPENGL window wnd it will be given to you at no cost! :) No problem at all. But GLES is more compatible than OpenGL, and would allow the game to run without X, directly on KMSDRM without an X server running (that's how I play all my games on the Pi). So if you can use GLES instead of old-style OpenGL (desktop only...) it would be better. And let SDL2 do the scaling, please. Software scaling is SLOW in things like the Pi.
That's amazing! I'll give it a try on the next session then! Thank you for the advice! Okay so with a quick glance at GLES, I see that they have 2D texture arrays (which is what I use now for tilemaps) in version 3. So maybe it won't be too bad!
@mdodis This is the fn that lets you create a window in SDL2:
https://wiki.libsdl.org/SDL_CreateWindow
Just pass the SDL_WINDOW_OPENGL flag, and presto!
You can also set the context version (GLES; OpenGL version, etc..)
This will init a GLES2 context:
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
SDL_GL_SetSwapInterval(0);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
Okay, a8a3c153a3335611854a06b40c19ab3e005b9ccf seems to be working ok, in terms of GLES stuff. I'll test out the KMSDRM backend to see if everything's alright tomorrow and then I'll upload the new build.
Thank you so much for the help!
@mdodis You seem to be using GLES3 there. Can you please use GLES2? That would allow Raspberry Pi 1-2-3 compatibility.
@mdodis Also remember that in order to test the KMSDRM backend, you have to build your own SDL2 passing --enable-video-kmsdrm
to the configure script.
You can do so in the latest SDL2 version from mercurial, which you can download like this:
hg clone http://hg.libsdl.org/SDL
@vanfanel Alright, I've tested it on the one machine I have and it seems to be working, (I also needed to build SDL with libudev). Audio should be working as well, though that's not a main priority.
Regarding the use of GLES3, that's going to take a bit more time because version 2 doesn't have the extension I use for tilemaps.
I loved Solomon's Key on the NES and it inspired some of the mechanics in my pygame-based game Flyboy.
Did you ever get the game running on gles and without requiring x-lib? I would like to add it to the portmaster project for the Anbernic rg351 retro handheld. The firmware I run on it lacks x-windows but well supports sld2.
I'm not 100% sure that it will work, but the latest version here does include an sdl_solomons_key executable that should support the KMS-DRM backend. I don't have anything to test it on right now but can you try running it with "-fullscreen"? It should work if your device supports GLES 3
Hi there!
I am a big fan of open source games on GNU/Linux and I would like to build this Solomon's Key to Raspberry Pi without Xorg. Gaming without Xorg is possible by using the KMSDRM backend that SDL2 has. So, do you have any plans for SDL2 instead of Xlib?