1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-12-12 19:20:29 +00:00

Generate individual display lists instead of relying on their names being contiguous

This commit is contained in:
Lignum 2018-02-24 17:21:12 +01:00
parent 244907a39a
commit e0c9dc24e7
No known key found for this signature in database
GPG Key ID: 8AD873773D8E25B7
2 changed files with 22 additions and 12 deletions

View File

@ -106,9 +106,15 @@ public class TileEntityMonitorRenderer extends TileEntitySpecialRenderer<TileMon
Palette palette = terminal.getPalette(); Palette palette = terminal.getPalette();
// Allocate display lists // Allocate display lists
if( originTerminal.renderDisplayList < 0 ) if( originTerminal.renderDisplayLists == null )
{ {
originTerminal.renderDisplayList = GlStateManager.glGenLists( 3 ); originTerminal.renderDisplayLists = new int[3];
for( int list = 0; list < originTerminal.renderDisplayLists.length; list++ )
{
originTerminal.renderDisplayLists[list] = GlStateManager.glGenLists( 1 );
}
redraw = true; redraw = true;
} }
@ -132,7 +138,7 @@ public class TileEntityMonitorRenderer extends TileEntitySpecialRenderer<TileMon
if( redraw ) if( redraw )
{ {
// Build background display list // Build background display list
GlStateManager.glNewList( originTerminal.renderDisplayList, GL11.GL_COMPILE ); GlStateManager.glNewList( originTerminal.renderDisplayLists[0], GL11.GL_COMPILE );
try try
{ {
double marginXSize = TileMonitor.RENDER_MARGIN / xScale; double marginXSize = TileMonitor.RENDER_MARGIN / xScale;
@ -171,7 +177,7 @@ public class TileEntityMonitorRenderer extends TileEntitySpecialRenderer<TileMon
GlStateManager.glEndList(); GlStateManager.glEndList();
} }
} }
GlStateManager.callList( originTerminal.renderDisplayList ); GlStateManager.callList( originTerminal.renderDisplayLists[0] );
GlStateManager.resetColor(); GlStateManager.resetColor();
// Draw text // Draw text
@ -179,7 +185,7 @@ public class TileEntityMonitorRenderer extends TileEntitySpecialRenderer<TileMon
if( redraw ) if( redraw )
{ {
// Build text display list // Build text display list
GlStateManager.glNewList( originTerminal.renderDisplayList + 1, GL11.GL_COMPILE ); GlStateManager.glNewList( originTerminal.renderDisplayLists[1], GL11.GL_COMPILE );
try try
{ {
// Lines // Lines
@ -199,7 +205,7 @@ public class TileEntityMonitorRenderer extends TileEntitySpecialRenderer<TileMon
GlStateManager.glEndList(); GlStateManager.glEndList();
} }
} }
GlStateManager.callList( originTerminal.renderDisplayList + 1 ); GlStateManager.callList( originTerminal.renderDisplayLists[1] );
GlStateManager.resetColor(); GlStateManager.resetColor();
// Draw cursor // Draw cursor
@ -207,7 +213,7 @@ public class TileEntityMonitorRenderer extends TileEntitySpecialRenderer<TileMon
if( redraw ) if( redraw )
{ {
// Build cursor display list // Build cursor display list
GlStateManager.glNewList( originTerminal.renderDisplayList + 2, GL11.GL_COMPILE ); GlStateManager.glNewList( originTerminal.renderDisplayLists[2], GL11.GL_COMPILE );
try try
{ {
// Cursor // Cursor
@ -233,7 +239,7 @@ public class TileEntityMonitorRenderer extends TileEntitySpecialRenderer<TileMon
} }
if( ComputerCraft.getGlobalCursorBlink() ) if( ComputerCraft.getGlobalCursorBlink() )
{ {
GlStateManager.callList( originTerminal.renderDisplayList + 2 ); GlStateManager.callList( originTerminal.renderDisplayLists[2] );
GlStateManager.resetColor(); GlStateManager.resetColor();
} }
} }

View File

@ -11,7 +11,7 @@ public class ClientMonitor extends ClientTerminal
private final TileMonitor origin; private final TileMonitor origin;
public long lastRenderFrame = -1; public long lastRenderFrame = -1;
public int renderDisplayList = -1; public int[] renderDisplayLists = null;
public ClientMonitor( boolean colour, TileMonitor origin ) public ClientMonitor( boolean colour, TileMonitor origin )
{ {
@ -26,10 +26,14 @@ public class ClientMonitor extends ClientTerminal
public void destroy() public void destroy()
{ {
if( renderDisplayList != -1 ) if( renderDisplayLists != null )
{ {
ComputerCraft.deleteDisplayLists( renderDisplayList, 3 ); for( int displayList : renderDisplayLists )
renderDisplayList = -1; {
ComputerCraft.deleteDisplayLists( displayList, 1 );
}
renderDisplayLists = null;
} }
} }
} }