Makes 2D text drawing via Canvas2D.

This was SVN commit r25607.
This commit is contained in:
vladislavbelov
2021-05-30 19:10:10 +00:00
parent 7f16a5c40c
commit 2cc671fd36
10 changed files with 46 additions and 57 deletions
+21
View File
@@ -21,6 +21,7 @@
#include "graphics/Color.h"
#include "graphics/ShaderManager.h"
#include "graphics/TextRenderer.h"
#include "graphics/TextureManager.h"
#include "gui/GUIMatrix.h"
#include "maths/Rect.h"
@@ -161,3 +162,23 @@ void CCanvas2D::DrawTexture(
DrawTextureImpl(texture, vertices, uvs, multiply, add, grayscaleFactor);
}
void CCanvas2D::DrawText(CTextRenderer& textRenderer)
{
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
CShaderDefines defines;
CShaderTechniquePtr tech = g_Renderer.GetShaderManager().LoadEffect(
str_canvas2d, g_Renderer.GetSystemShaderDefines(), defines);
tech->BeginPass();
CShaderProgramPtr shader = tech->GetShader();
shader->Uniform(str_grayscaleFactor, 0.0f);
textRenderer.Render(shader);
tech->EndPass();
glDisable(GL_BLEND);
}