Skip to content

Commit

Permalink
Section:Changing the Border and Fill Colors Independently
Browse files Browse the repository at this point in the history
  • Loading branch information
enobayram committed Nov 14, 2015
1 parent 3baf517 commit b96a7bd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Binary file modified plump.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions text_and_shaders.ini
Expand Up @@ -16,6 +16,8 @@ Position = (0.0, 0.0, -1.0)

[TextObject]
Graphic = TextGraphic
ShaderList = TextShader
Color = (255,255,255)

[TextGraphic]
Text = TextWithCustomFont
Expand All @@ -25,4 +27,19 @@ Pivot = center
String = HELLO WORLD!!
Font = plump

[TextShader]
ParamList = texture # BorderColor ; We've added a new parameter
Code = "
void main() {
// Get the texture value for the current pixel
vec4 tex = texture2D(texture, gl_TexCoord[0].xy);
// Here's the fun; We blend in the border color based on R channel
gl_FragColor.rgb = mix(vec3(1.0), BorderColor, tex.r) * gl_Color.rgb;
// Set the pixel alpha to the texture's alpha multiplied by the object's
gl_FragColor.a = tex.a * gl_Color.a;
}"
BorderColor = (0,0,255) ; Let's make the border blue, just for fun.

@plump.ini@

0 comments on commit b96a7bd

Please sign in to comment.