diff --git a/src/main/java/com/jozufozu/flywheel/backend/Backend.java b/src/main/java/com/jozufozu/flywheel/backend/Backend.java index b56df9c5c..7317f62a9 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/Backend.java +++ b/src/main/java/com/jozufozu/flywheel/backend/Backend.java @@ -74,7 +74,7 @@ public class Backend { }); private static Matrix4f projectionMatrix = new Matrix4f(); - private static boolean instancingAvailable; + private static boolean instancedArrays; private static boolean enabled; static final Map> materialRegistry = new HashMap<>(); @@ -108,6 +108,18 @@ public class Backend { throw new IllegalStateException(); } + public static String getBackendDescriptor() { + if (canUseInstancing()) { + return "GL33 Instanced Arrays"; + } + + if (canUseVBOs()) { + return "VBOs"; + } + + return "Disabled"; + } + /** * Register a shader program. */ @@ -156,7 +168,7 @@ public class Backend { } public static boolean canUseInstancing() { - return enabled && instancingAvailable; + return enabled && instancedArrays; } public static boolean canUseVBOs() { @@ -189,7 +201,7 @@ public class Backend { compat = new GlCompat(capabilities); - instancingAvailable = compat.vertexArrayObjectsSupported() && + instancedArrays = compat.vertexArrayObjectsSupported() && compat.drawInstancedSupported() && compat.instancedArraysSupported(); diff --git a/src/main/java/com/jozufozu/flywheel/backend/model/BufferedModel.java b/src/main/java/com/jozufozu/flywheel/backend/model/BufferedModel.java index 633052620..7ed50b701 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/model/BufferedModel.java +++ b/src/main/java/com/jozufozu/flywheel/backend/model/BufferedModel.java @@ -47,14 +47,6 @@ public class BufferedModel { return vertexCount; } - public void bindBuffer() { - vbo.bind(); - } - - public void unbindBuffer() { - vbo.unbind(); - } - public boolean valid() { return vertexCount > 0 && !deleted; } diff --git a/src/main/java/com/jozufozu/flywheel/event/ForgeEvents.java b/src/main/java/com/jozufozu/flywheel/event/ForgeEvents.java new file mode 100644 index 000000000..c77665233 --- /dev/null +++ b/src/main/java/com/jozufozu/flywheel/event/ForgeEvents.java @@ -0,0 +1,32 @@ +package com.jozufozu.flywheel.event; + +import java.util.ArrayList; + +import com.jozufozu.flywheel.backend.Backend; + +import net.minecraft.client.Minecraft; +import net.minecraftforge.client.event.RenderGameOverlayEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.common.Mod; + +@Mod.EventBusSubscriber +public class ForgeEvents { + + @SubscribeEvent + public static void addToDebugScreen(RenderGameOverlayEvent.Text event) { + + if (Minecraft.getInstance().gameSettings.showDebugInfo) { + + ArrayList right = event.getRight(); + + String text = "Flywheel: " + Backend.getBackendDescriptor(); + if (right.size() < 10) { + right.add(""); + right.add(text); + } else { + right.add(9, ""); + right.add(10, text); + } + } + } +}