Open AtkinsSJ opened 5 years ago
HamSandwich is currently using SDL2 for input/windowing, but everything is still software rendering. Moving everything to OpenGL would be a lot of work, but I agree with your assessment that it would probably be faster. I've been experimenting with Android and Emscripten targets so I think it would make sense to target OpenGL ES.
Thanks for the link, I'll be sure to reference it if I ever decide to try rewriting the rendering.
Yo!
A while ago I made a start on converting the Dr Lunatic code to use SDL/OpenGL for rendering. I didn't get that far, it literally just fades the Hamumu logo in and out again, but I did write a shader that draws images using a palette, which I thought might be useful. (It surprised me how simple it is to do that.)
Vertex shader:
Fragment shader:
The palette is sent by just telling opengl to load its memory as a 1D texture. Images are sent as-is to the GPU, as 2D, single-channel textures. It means you can still use the original palette-switching code, and 256-colour bitmaps, without changing them.
Theoretically using opengl would be faster than software-rendering, but I never got far enough to test that assumption, and rendering the game itself is obviously a lot more complicated than a flat image, and might require a decent amount of restructuring.
So yeah, I don't know how helpful this is, or whether that's even a direction you'd want to go in, but I thought it's better to actually share this than just leaving it rotting on my HDD. (Maybe you already know graphicsy stuff, so I really hope this doesn't seem patronising!) The whole repo is at https://bitbucket.org/AtkinsSJ/glunatic (Not github because it was private until just now and github doesn't have free private repos and I am cheap. Sorry.) Feel free to yell at me if you have any questions.