Skip to content

Commit 35d7c53

Browse files
committed
Characters from different texture pages must be rendered separately.
1 parent a04b891 commit 35d7c53

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

src/BitmapText.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ void BitmapText::DrawChars( bool bUseStrokeTexture )
438438
{
439439
haveTextures = true;
440440

441-
switch (texUnit)
441+
switch ( texUnit )
442442
{
443443
case 0:
444444
textureUnit = TextureUnit_1;
@@ -466,10 +466,10 @@ void BitmapText::DrawChars( bool bUseStrokeTexture )
466466
break;
467467
}
468468

469-
if( bUseStrokeTexture )
470-
DISPLAY->SetTexture(textureUnit, m_vpFontPageTextures[start]->m_pTextureStroke->GetTexHandle() );
469+
if ( bUseStrokeTexture )
470+
DISPLAY->SetTexture( textureUnit, m_vpFontPageTextures[start]->m_pTextureStroke->GetTexHandle() );
471471
else
472-
DISPLAY->SetTexture(textureUnit, m_vpFontPageTextures[start]->m_pTextureMain->GetTexHandle() );
472+
DISPLAY->SetTexture( textureUnit, m_vpFontPageTextures[start]->m_pTextureMain->GetTexHandle() );
473473

474474
texUnit++;
475475

@@ -480,17 +480,22 @@ void BitmapText::DrawChars( bool bUseStrokeTexture )
480480

481481
// This is SLOW. We need to do something else about this. -Colby
482482
//Actor::SetTextureRenderStates();
483-
484483
}
485484

486-
if (texUnit == 8 || (haveTextures && end >= iEndGlyph) || texUnit > DISPLAY->GetNumTextureUnits() || !PREFSMAN->m_bAllowMultitexture)
485+
// Characters from different texture pages cannot be bundled together in the same render call
486+
bool renderNow = false;
487+
if ( haveTextures && end < m_vpFontPageTextures.size() && m_vpFontPageTextures[start]->m_pTextureMain != m_vpFontPageTextures[end]->m_pTextureMain )
488+
renderNow = true;
489+
490+
if ( (haveTextures && (renderNow || end >= iEndGlyph)) || texUnit == 8 || texUnit > DISPLAY->GetNumTextureUnits() || !PREFSMAN->m_bAllowMultitexture )
487491
{
488492
DISPLAY->DrawQuads(&m_aVertices[startingPoint * 4], (end - startingPoint) * 4);
489493

490494
// Setup for the next render pass
491495
DISPLAY->ClearAllTextures();
492496
startingPoint = end;
493497
texUnit = 0;
498+
haveTextures = false;
494499
}
495500

496501
start = end;

0 commit comments

Comments
 (0)