mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-12-14 20:20:30 +00:00
Use VBO renderer when Optifine is installed
Historically I've been reluctant to do this as people might be running Optifine for performance rather than shaders, and the VBO renderer was significantly slower when monitors were changing. With the recent performance optimisations, the difference isn't as bad. Given how many people ask/complain about the TBO renderer and shaders, I think it's worth doing this, even if it's not as granular as I'd like. Also changes how we do the monitor backend check. We now only check for compatibility if BEST is selected - if there's an override, we assume the user knows what they're doing (a bold assumption, if I may say so myself).
This commit is contained in:
parent
22e8b9b587
commit
4bfdb65989
@ -7,6 +7,7 @@ package dan200.computercraft.shared.peripheral.monitor;
|
|||||||
|
|
||||||
import dan200.computercraft.ComputerCraft;
|
import dan200.computercraft.ComputerCraft;
|
||||||
import dan200.computercraft.client.render.TileEntityMonitorRenderer;
|
import dan200.computercraft.client.render.TileEntityMonitorRenderer;
|
||||||
|
import net.minecraftforge.fml.ModList;
|
||||||
import org.lwjgl.opengl.GL;
|
import org.lwjgl.opengl.GL;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
@ -47,39 +48,24 @@ public enum MonitorRenderer
|
|||||||
public static MonitorRenderer current()
|
public static MonitorRenderer current()
|
||||||
{
|
{
|
||||||
MonitorRenderer current = ComputerCraft.monitorRenderer;
|
MonitorRenderer current = ComputerCraft.monitorRenderer;
|
||||||
switch( current )
|
if( current == BEST ) current = ComputerCraft.monitorRenderer = best();
|
||||||
{
|
|
||||||
case BEST:
|
|
||||||
return best();
|
|
||||||
case TBO:
|
|
||||||
checkCapabilities();
|
|
||||||
if( !textureBuffer )
|
|
||||||
{
|
|
||||||
ComputerCraft.log.warn( "Texture buffers are not supported on your graphics card. Falling back to default." );
|
|
||||||
ComputerCraft.monitorRenderer = BEST;
|
|
||||||
return best();
|
|
||||||
}
|
|
||||||
|
|
||||||
return TBO;
|
|
||||||
default:
|
|
||||||
return current;
|
return current;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private static MonitorRenderer best()
|
private static MonitorRenderer best()
|
||||||
{
|
{
|
||||||
checkCapabilities();
|
if( !GL.getCapabilities().OpenGL31 )
|
||||||
return textureBuffer ? TBO : VBO;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean initialised = false;
|
|
||||||
private static boolean textureBuffer = false;
|
|
||||||
|
|
||||||
private static void checkCapabilities()
|
|
||||||
{
|
{
|
||||||
if( initialised ) return;
|
ComputerCraft.log.warn( "Texture buffers are not supported on your graphics card. Falling back to VBO monitor renderer." );
|
||||||
|
return VBO;
|
||||||
|
}
|
||||||
|
|
||||||
textureBuffer = GL.getCapabilities().OpenGL31;
|
if( ModList.get().isLoaded( "optifine" ) )
|
||||||
initialised = true;
|
{
|
||||||
|
ComputerCraft.log.warn( "Optifine is loaded, assuming shaders are being used. Falling back to VBO monitor renderer." );
|
||||||
|
return VBO;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TBO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user