Skip to content

Commit

Permalink
add gl33 check
Browse files Browse the repository at this point in the history
  • Loading branch information
Rogo committed Apr 10, 2024
1 parent 545e3a5 commit 25fad50
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/rogo/renderingculling/api/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static void setSampling(double value) {
private static final PropertyMirror<Boolean> CULL_ENTITY = PropertyMirror.create(ConfigTypes.BOOLEAN);

public static boolean getCullEntity() {
if(unload())
if(unload() || !CullingHandler.gl33())
return false;
return CULL_ENTITY.getValue();
}
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/rogo/renderingculling/api/CullingHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;
import org.lwjgl.glfw.GLFW;
import org.lwjgl.opengl.GL;
import org.lwjgl.system.Checks;
import org.slf4j.Logger;
import rogo.renderingculling.event.WorldUnloadEvent;
import rogo.renderingculling.gui.ConfigScreen;
Expand Down Expand Up @@ -682,4 +684,13 @@ public static boolean anyNeedTransfer() {
return (CullingHandler.ENTITY_CULLING_MAP != null && CullingHandler.ENTITY_CULLING_MAP.needTransferData()) ||
(CullingHandler.CHUNK_CULLING_MAP != null && CullingHandler.CHUNK_CULLING_MAP.needTransferData());
}

private static int gl33 = -1;
public static boolean gl33() {
if(RenderSystem.isOnRenderThread()) {
if(gl33 < 0)
gl33 = (GL.getCapabilities().OpenGL33 || Checks.checkFunctions(GL.getCapabilities().glVertexAttribDivisor)) ? 1 : 0;
}
return gl33 == 1;
}
}

0 comments on commit 25fad50

Please sign in to comment.