Age | Commit message (Collapse) | Author |
|
Emscripten support is strictly GLES2 which is why the shaders
were migrated to GLSL 1. I was hoping the already supported
desktop operating systems would be able to handle the GLSL 1
shaders and GLES2-constrained API usage on a GL 2.1 context, but
MacOS seems to be angry about this, Tara reported testing
rev4-rc{9,10}:
Fatal error: Error compiling vertex shader: "ERROR: 0:1: '' :
version '100' is not supported
Which is further than rc8 got, that couldn't even create a
window. And since this seems to be at least reaching shader
compilation, which is pretty deep into sars as far as exercising
GL functionality, I'm just resorting to gross granular #ifdef
__EMSCRIPTEN__ fuckery in the shaders to provide GLSL 1.2 shaders
on non-emscripten builds (including MacOS), and GLSL 1 shaders on
just emscripten.
Fortunately in sars there just isn't much shader code, so it's
not especially painful.
But future titles building upon this codebase and these
assumptions may become quite painful if using this approach to
support emscripten and desktop GL. Or if sars evolves to make
more sophisticated use of shaders, this could introduce
substantial development and maintenance overhead.
TL;DR: I hate this commit, but it seems like the shortest path
right now to make everything happy again in an emscripten
supported world.
|
|
In the interests of keeping things bisectable this is one big commit of
everything necessary to go from OpenGL 2.1 to OpenGL ES 2.0 in one fell
swoop.
There's a handful of annoying mechanical changes necessary in shaders like
removing the 'f' suffix on float constants e.g. 1.f becomes 1.0 etc.
This is primarily happening to enable emscripten builds
|
|
The bulk of this is mechanical wiring up of a projection_x to all
the nodes.
But this also introduces maintenance of the projection_x, with
aspect-ratio preservation in two of the modes: WINDOWED and
FULLSCREEN, with the previously default stretched-to-fill
fullscreen mode now relegated to a third FILLSCREEN winmode.
The default at startup is now an aspect ratio-preserving windowed
mode.
Simply press the 'f' key at any time to cycle through them.
This was mostly done in sars to provide a source-available test
for reproducing a fullscreen SDL2 bug I filed @
https://github.com/libsdl-org/SDL/issues/5139
Otherwise it's pretty silly to bother with doing anything on
sars... but it is a handy little mule for such things.
|
|
Even with the MSAA off there were occasional fringes showing up,
turns out it's because of the default GL texture wrap mode.
|
|
The theme of this Blender was:
Monkeys / Rescuing / Between Realities
With all the COVID-19 stuff going on, it seemed like a fun way
to lighten things up a bit to make something where a monkey runs
around trying to rescue child monkeys from coronaviruses moving
across the playfield. In keeping with the theme, to rescue the
helpless monkeys you take them to a different reality by carrying
them off the window/screen. As infections increase the field
becomes crowded with viruses until your player becomes infected
through contact, ending your game.
This was written quickly kamikaze style overnight. Some
scaffolding bits came from past projects of mine like the vector
headers, shader and texture node building blocks, and the plasma
effect has been used a few times now and originally was derived
from some gpu programming tutorial if memory serves. I just
wanted to put something in the background for this strange
reality.
This is the first time I've used libplay, in fact, it was
basically slapped together last night at the start of this to
avoid having to do all that SDL initialization all over again.
The unique meat of this work is in game.c, there isn't really all
that much to this game though. It's not pretty code, but it
works well enough and this task served as a useful exercise of
trying to get some quick game dev done using this collection of
facilities.
Most the heavy lifting comes from my reused libraries which are
slowly evolving into something somewhat effective for simple game
development.
Enjoy, and happy hacking!
|