Skip to content

Commit

Permalink
UPBGE: Fix not culled texts.
Browse files Browse the repository at this point in the history
Previously the cullings setting (cull enabled and front face) was not
applied before rendering the text objects. It created that if the object
renderd just before this text was not using culling then the text will
not use culling.

To solve this issue a call to Enable(RAS_CULL_FACE) was added in the
funcition RAS_OpenGLRasterizer::DisableForText().

Also functions RenderText3D and RenderText2D set their own front face mode.
  • Loading branch information
youle31 authored and panzergame committed Aug 28, 2016
1 parent c032791 commit 18c0d1c
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2078,7 +2078,8 @@ void RAS_OpenGLRasterizer::DisableForText()
{
SetAlphaBlend(GPU_BLEND_ALPHA);
SetLines(false); /* needed for texture fonts otherwise they render as wireframe */
SetFrontFace(true);

Enable(RAS_CULL_FACE);

ProcessLighting(false, MT_Transform::Identity());

Expand Down Expand Up @@ -2149,6 +2150,7 @@ void RAS_OpenGLRasterizer::RenderText3D(
{
/* gl prepping */
DisableForText();
SetFrontFace(true);

/* the actual drawing */
glColor4fv(color);
Expand Down Expand Up @@ -2181,6 +2183,7 @@ void RAS_OpenGLRasterizer::RenderText2D(
* behind quite as neatly as we'd have wanted to. I don't know
* what cause it, though :/ .*/
DisableForText();
SetFrontFace(true);
Disable(RAS_DEPTH_TEST);

SetMatrixMode(RAS_PROJECTION);
Expand Down

0 comments on commit 18c0d1c

Please sign in to comment.