inline OpenGL constants to lwjgl GLxx

This commit is contained in:
Sen 2025-03-18 10:14:37 +01:00
parent a891ab4d3a
commit 783adb350b
20 changed files with 183 additions and 495 deletions

View file

@ -40,6 +40,9 @@ import java.util.function.Function;
import javax.imageio.ImageIO;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL13;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.util.concurrent.Futures;
@ -480,8 +483,8 @@ public class Game implements IThreadListener {
this.textureMap = new TextureMap();
this.textureManager.loadTexture(TextureMap.locationBlocksTexture, this.textureMap);
this.textureManager.bindTexture(TextureMap.locationBlocksTexture);
WCF.glTexParameteri(WCF.GL_TEXTURE_MIN_FILTER, WCF.GL_NEAREST);
WCF.glTexParameteri(WCF.GL_TEXTURE_MAG_FILTER, WCF.GL_NEAREST);
WCF.glTexParameteri(GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
WCF.glTexParameteri(GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
this.modelManager = new ModelManager(this.textureMap);
this.modelManager.onReload();
this.renderItem = new RenderItem(this.textureManager, this.modelManager);
@ -695,10 +698,10 @@ public class Game implements IThreadListener {
}
public void render() {
GlState.tryBlendFuncSeparate(WCF.GL_SRC_ALPHA, WCF.GL_ONE_MINUS_SRC_ALPHA, WCF.GL_SRC_ALPHA, WCF.GL_ONE_MINUS_SRC_ALPHA);
GlState.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlState.enableDepth();
GlState.clearColor(0.0f, 0.0f, 0.0f, 1.0f);
WCF.glClear(WCF.GL_COLOR_BUFFER_BIT | WCF.GL_DEPTH_BUFFER_BIT);
WCF.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
if(this.wireframe) {
WCF.glLineWidth(1.0f);
WCF.glPolygonMode(true); // GL_FRONT_AND_BACK, GL_LINE
@ -884,7 +887,7 @@ public class Game implements IThreadListener {
// jsys.tooltip[0] = 0;
// this.tooltip = null;
// GlState.resetTextures();
GlState.setActiveTexture(WCF.GL_TEXTURE0);
GlState.setActiveTexture(GL13.GL_TEXTURE0);
GlState.enableTexture2D();
// GlState.disableDepth();
if(this.open == null && this.getRenderViewEntity() != null && this.getRenderViewEntity().isPlayer()) {
@ -977,8 +980,8 @@ public class Game implements IThreadListener {
"Tickrate: %s%.2f" + TextColor.RESET + " %s [" + TextColor.GREEN + "%.1f" + TextColor.RESET + "], %.3f ms, E %d ms" +
"%s%s"
,
WCF.glGetString(WCF.GL_VERSION), // WCF.glGetString(WCF.GL_SHADING_LANGUAGE_VERSION),
WCF.glGetString(WCF.GL_RENDERER), WCF.glGetString(WCF.GL_VENDOR),
WCF.glGetString(GL11.GL_VERSION), // WCF.glGetString(WCF.GL_SHADING_LANGUAGE_VERSION),
WCF.glGetString(GL11.GL_RENDERER), WCF.glGetString(GL11.GL_VENDOR),
this.framecode(), Timing.framerate < 1.0f ? 1.0f / Timing.framerate : Timing.framerate, Timing.framerate < 1.0f ? "SPF" : "FPS",
this.vsync ? TextColor.DGRAY + "VSYNC" : (this.syncLimited ? TextColor.GREEN + "" + this.syncLimit : TextColor.RED + "UNL"),
(float)PerfSection.getTotal(false) / 1000.0f, this.fb_x, this.fb_y,
@ -2000,8 +2003,8 @@ public class Game implements IThreadListener {
public void setupOverlay() {
GlState.disableDepth();
GlState.tryBlendFuncSeparate(WCF.GL_SRC_ALPHA, WCF.GL_ONE_MINUS_SRC_ALPHA, WCF.GL_ONE, WCF.GL_ONE_MINUS_SRC_ALPHA);
GlState.setActiveTexture(WCF.GL_TEXTURE0);
GlState.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlState.setActiveTexture(GL13.GL_TEXTURE0);
GlState.color(1.0f, 1.0f, 1.0f, 1.0f);
WCF.glClear(256);
WCF.glMatrixMode(5889);
@ -2018,9 +2021,9 @@ public class Game implements IThreadListener {
Log.SYSTEM.info(Config.VERSION);
if(!WCF.createWindow(Config.VERSION, System.getProperty("opengl.debug") != null))
System.exit(1);
Log.SYSTEM.info("OpenGL %s", WCF.glGetString(WCF.GL_VERSION));
Log.SYSTEM.info("GL_VENDOR: %s", WCF.glGetString(WCF.GL_VENDOR));
Log.SYSTEM.info("GL_RENDERER: %s", WCF.glGetString(WCF.GL_RENDERER));
Log.SYSTEM.info("OpenGL %s", WCF.glGetString(GL11.GL_VERSION));
Log.SYSTEM.info("GL_VENDOR: %s", WCF.glGetString(GL11.GL_VENDOR));
Log.SYSTEM.info("GL_RENDERER: %s", WCF.glGetString(GL11.GL_RENDERER));
Log.SYSTEM.info("Starte ...");
this.init();
@ -2029,7 +2032,7 @@ public class Game implements IThreadListener {
System.gc();
Font.load();
GlState.enableBlend();
GlState.blendFunc(WCF.GL_SRC_ALPHA, WCF.GL_ONE_MINUS_SRC_ALPHA);
GlState.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
this.initConsole();
this.vidMode = WCF.getDisplayMode();
WCF.initWindow(this.saved_xpos, this.saved_ypos, this.xsize, this.ysize);
@ -2056,7 +2059,7 @@ public class Game implements IThreadListener {
Bind.updateBinds();
this.input();
Bind.enableInput();
GlState.setActiveTexture(WCF.GL_TEXTURE0);
GlState.setActiveTexture(GL13.GL_TEXTURE0);
GlState.bindTexture(0);
this.inputGui();
if(this.open != null)