vittorioromeo / SSVOpenHexagon

C++20 FOSS clone of "Super Hexagon". Depends on SSVStart, SSVEntitySystem, SSVLuaWrapper, SSVMenuSystem, JSONcpp, SFML2.0. Features JSON/LUA customizable game files, a soundtrack by BOSSFIGHT, pseudo-3D effects.
https://vittorioromeo.com/openhexagon.html
Other
610 stars 76 forks source link

Add text shaders #386

Closed Bauumm closed 2 years ago

Bauumm commented 2 years ago

This pr adds the ability to modify the text color with fragment shaders. However it is a bit more unintuitive than the other RenderStages. So a shader that sets the outline to red and the text to green could look like this:

#version 130
uniform vec4 color0;
uniform sampler2D font;

void main()
{
    vec4 color = gl_Color.rgb == color0.rgb ? vec4(1,0,0,1) : vec4(0,1,0,1);
    gl_FragColor = color * texture(font, gl_TexCoord[0].xy);
}

with color0 being s_getColor(0) in order to set an outline color.

vittorioromeo commented 2 years ago

Looks interesting! Could you add an example level using this as part of the PR, so that I can test it easily? Thank you.

vittorioromeo commented 2 years ago

LGTM, thanks!