diff --git a/game_scene.cpp b/game_scene.cpp index 42dc023..7391c4c 100644 --- a/game_scene.cpp +++ b/game_scene.cpp @@ -137,7 +137,7 @@ GameScene::GameScene() { //_font_test_mi->transform.scale(Vector2(10, 10)); _font_test_mi->transform.set_origin(Vector2(1000, 400)); - _font->generate_mesh("asdfgh\nasdfvb", _font_test_mesh); + _font->generate_mesh("asdfgh\nasdfvb", _font_test_mesh, Color(1, 1, 0)); _font_test_mesh->upload(); image.instance(); diff --git a/sfw/render_core/font_material.h b/sfw/render_core/font_material.h index b69955a..68e3743 100644 --- a/sfw/render_core/font_material.h +++ b/sfw/render_core/font_material.h @@ -45,11 +45,14 @@ public: "\n" "attribute vec4 a_position;\n" "attribute vec2 a_uv;\n" + "attribute vec4 a_color;\n" "\n" "varying vec2 v_uv;\n" + "varying vec4 v_color;\n" "\n" "void main() {\n" " v_uv = a_uv;\n" + " v_color = a_color;\n" " gl_Position = u_proj_matrix * u_model_view_matrix * a_position;\n" "}" }; @@ -64,6 +67,7 @@ public: "uniform sampler2D u_texture;\n" "\n" "varying vec2 v_uv;\n" + "varying vec4 v_color;\n" "\n" "void main() {\n" " vec4 col = texture2D(u_texture, v_uv);\n" @@ -72,7 +76,7 @@ public: " discard;\n" " }\n" "\n" - " gl_FragColor = col;\n" + " gl_FragColor = col * v_color;\n" "}" };