mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-12-14 12:10: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.client.render.TileEntityMonitorRenderer;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import org.lwjgl.opengl.GL;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@ -47,39 +48,24 @@ public enum MonitorRenderer
|
||||
public static MonitorRenderer current()
|
||||
{
|
||||
MonitorRenderer current = ComputerCraft.monitorRenderer;
|
||||
switch( current )
|
||||
{
|
||||
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;
|
||||
}
|
||||
if( current == BEST ) current = ComputerCraft.monitorRenderer = best();
|
||||
return current;
|
||||
}
|
||||
|
||||
private static MonitorRenderer best()
|
||||
{
|
||||
checkCapabilities();
|
||||
return textureBuffer ? TBO : VBO;
|
||||
}
|
||||
if( !GL.getCapabilities().OpenGL31 )
|
||||
{
|
||||
ComputerCraft.log.warn( "Texture buffers are not supported on your graphics card. Falling back to VBO monitor renderer." );
|
||||
return VBO;
|
||||
}
|
||||
|
||||
private static boolean initialised = false;
|
||||
private static boolean textureBuffer = false;
|
||||
if( ModList.get().isLoaded( "optifine" ) )
|
||||
{
|
||||
ComputerCraft.log.warn( "Optifine is loaded, assuming shaders are being used. Falling back to VBO monitor renderer." );
|
||||
return VBO;
|
||||
}
|
||||
|
||||
private static void checkCapabilities()
|
||||
{
|
||||
if( initialised ) return;
|
||||
|
||||
textureBuffer = GL.getCapabilities().OpenGL31;
|
||||
initialised = true;
|
||||
return TBO;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user