inline OpenGL functions to lwjgl GLxx
This commit is contained in:
parent
783adb350b
commit
a2ffb2991d
90 changed files with 1008 additions and 1204 deletions
|
@ -144,8 +144,8 @@ import game.window.Button;
|
|||
import game.window.DisplayMode;
|
||||
import game.window.KeyEvent;
|
||||
import game.window.Keysym;
|
||||
import game.window.WCF;
|
||||
import game.window.Wheel;
|
||||
import game.window.Window;
|
||||
import game.window.WindowEvent;
|
||||
import game.world.BlockPos;
|
||||
import game.world.BoundingBox;
|
||||
|
@ -477,14 +477,14 @@ public class Game implements IThreadListener {
|
|||
GlState.alphaFunc(516, 0.1F);
|
||||
GlState.cullFace(1029);
|
||||
GlState.enableCull();
|
||||
WCF.glMatrixMode(5889);
|
||||
WCF.glLoadIdentity();
|
||||
WCF.glMatrixMode(5888);
|
||||
GL11.glMatrixMode(5889);
|
||||
GL11.glLoadIdentity();
|
||||
GL11.glMatrixMode(5888);
|
||||
this.textureMap = new TextureMap();
|
||||
this.textureManager.loadTexture(TextureMap.locationBlocksTexture, this.textureMap);
|
||||
this.textureManager.bindTexture(TextureMap.locationBlocksTexture);
|
||||
WCF.glTexParameteri(GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
|
||||
WCF.glTexParameteri(GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
|
||||
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
|
||||
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, 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);
|
||||
|
@ -701,10 +701,10 @@ public class Game implements IThreadListener {
|
|||
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(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
|
||||
GL11.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
|
||||
GL11.glLineWidth(1.0f);
|
||||
GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE); // GL_FRONT_AND_BACK, GL_LINE
|
||||
}
|
||||
if(this.open == null) {
|
||||
if(this.thePlayer != null)
|
||||
|
@ -715,18 +715,18 @@ public class Game implements IThreadListener {
|
|||
this.soundManager.setListener(this.thePlayer, (float)Timing.tick_fraction);
|
||||
if(this.thePlayer != null && this.thePlayer.isEntityInsideOpaqueBlock())
|
||||
this.thirdPersonView = 0;
|
||||
WCF.glPushMatrix();
|
||||
WCF.glClear(16640);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glClear(16640);
|
||||
GlState.enableTexture2D();
|
||||
if(this.theWorld != null)
|
||||
this.entityRenderer.renderWorld((float)Timing.tick_fraction, System.nanoTime() - this.tickStart);
|
||||
WCF.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GlState.disableTexture2D();
|
||||
GlState.disableCull();
|
||||
GlState.enableBlend();
|
||||
if(this.wireframe)
|
||||
WCF.glPolygonMode(false); // GL_FRONT_AND_BACK, GL_FILL
|
||||
GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL); // GL_FRONT_AND_BACK, GL_FILL
|
||||
}
|
||||
|
||||
private static int stats(int x, int y, String name, int value, int max, int color) {
|
||||
|
@ -898,9 +898,9 @@ public class Game implements IThreadListener {
|
|||
// GlState.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||
ItemRenderer.enableGUIStandardItemLighting();
|
||||
// this.getTextureManager().bindTexture("textures/gui/inventory.png");
|
||||
WCF.glPushMatrix();
|
||||
WCF.glTranslatef(this.fb_x / 2 - 180 + 4 + 1, this.fb_y - 40 + 1, 0.0f);
|
||||
WCF.glScalef(2.0f, 2.0f, 2.0f);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)(this.fb_x / 2 - 180 + 4 + 1), (float)(this.fb_y - 40 + 1), 0.0f);
|
||||
GL11.glScalef(2.0f, 2.0f, 2.0f);
|
||||
|
||||
for(int index = 0; index < 9; ++index) {
|
||||
int xPos = index * 20;
|
||||
|
@ -913,7 +913,7 @@ public class Game implements IThreadListener {
|
|||
}
|
||||
}
|
||||
|
||||
WCF.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
ItemRenderer.disableStandardItemLighting();
|
||||
GlState.disableRescaleNormal();
|
||||
GlState.disableBlend();
|
||||
|
@ -980,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(GL11.GL_VERSION), // WCF.glGetString(WCF.GL_SHADING_LANGUAGE_VERSION),
|
||||
WCF.glGetString(GL11.GL_RENDERER), WCF.glGetString(GL11.GL_VENDOR),
|
||||
GL11.glGetString(GL11.GL_VERSION), // WCF.glGetString(WCF.GL_SHADING_LANGUAGE_VERSION),
|
||||
GL11.glGetString(GL11.GL_RENDERER), GL11.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,
|
||||
|
@ -1141,14 +1141,14 @@ public class Game implements IThreadListener {
|
|||
// SKC.setGuiMenu();
|
||||
// else
|
||||
// SKC.setGuiAny();
|
||||
WCF.setTitle(String.format("%s - %s", Config.VERSION, gui.getTitle()));
|
||||
Window.setTitle(String.format("%s - %s", Config.VERSION, gui.getTitle()));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.menu(false);
|
||||
this.leftClickCounter = 10000;
|
||||
Bind.disableMouse();
|
||||
WCF.setTitle(String.format("%s - %s%s", Config.VERSION, "Welt / Render", this.nograb ? "" : " (Maus gefangen)"));
|
||||
Window.setTitle(String.format("%s - %s%s", Config.VERSION, "Welt / Render", this.nograb ? "" : " (Maus gefangen)"));
|
||||
// SKC.setGuiNone();
|
||||
}
|
||||
}
|
||||
|
@ -1813,7 +1813,7 @@ public class Game implements IThreadListener {
|
|||
}
|
||||
|
||||
private void fbsize(int x, int y) {
|
||||
WCF.glViewport(0, 0, x, y);
|
||||
GL11.glViewport(0, 0, x, y);
|
||||
fb_x = x;
|
||||
fb_y = y;
|
||||
if(this.open != null)
|
||||
|
@ -1928,7 +1928,7 @@ public class Game implements IThreadListener {
|
|||
}
|
||||
|
||||
public void poll() {
|
||||
for(WindowEvent event : WCF.poll()) {
|
||||
for(WindowEvent event : Window.poll()) {
|
||||
switch(event.action) {
|
||||
case BUTTON:
|
||||
if(event.param1 >= 0 && event.param1 < Button.values().length)
|
||||
|
@ -1971,19 +1971,19 @@ public class Game implements IThreadListener {
|
|||
|
||||
|
||||
public void menu(boolean menu) {
|
||||
WCF.grabCursor(!menu && !nograb);
|
||||
Window.grabCursor(!menu && !nograb);
|
||||
mouseFirst = true;
|
||||
}
|
||||
|
||||
public void full(boolean full) {
|
||||
if(full != fullscreen && (!full || vidMode != null)) {
|
||||
if(full) {
|
||||
WCF.setFullscreen(vidMode.width, vidMode.height, vidMode.refresh);
|
||||
Window.setFullscreen(vidMode.width, vidMode.height, vidMode.refresh);
|
||||
}
|
||||
else {
|
||||
WCF.setWindowed(saved_xpos, saved_ypos, xsize, ysize);
|
||||
Window.setWindowed(saved_xpos, saved_ypos, xsize, ysize);
|
||||
}
|
||||
WCF.setVSync(vsync);
|
||||
Window.setVSync(vsync);
|
||||
fullscreen = full;
|
||||
}
|
||||
}
|
||||
|
@ -1995,10 +1995,10 @@ public class Game implements IThreadListener {
|
|||
syncLimit = sync;
|
||||
}
|
||||
else {
|
||||
DisplayMode mode = WCF.getDisplayMode();
|
||||
DisplayMode mode = Window.getDisplayMode();
|
||||
syncLimit = mode != null ? mode.refresh : 60;
|
||||
}
|
||||
WCF.setVSync(vsync);
|
||||
Window.setVSync(vsync);
|
||||
}
|
||||
|
||||
public void setupOverlay() {
|
||||
|
@ -2006,24 +2006,24 @@ public class Game implements IThreadListener {
|
|||
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);
|
||||
WCF.glLoadIdentity();
|
||||
WCF.glOrtho(0.0D, (double)this.fb_x, (double)this.fb_y, 0.0D, 1000.0D, 3000.0D);
|
||||
WCF.glMatrixMode(5888);
|
||||
WCF.glLoadIdentity();
|
||||
WCF.glTranslatef(0.0F, 0.0F, -2000.0F);
|
||||
GL11.glClear(256);
|
||||
GL11.glMatrixMode(5889);
|
||||
GL11.glLoadIdentity();
|
||||
GL11.glOrtho(0.0D, (double)this.fb_x, (double)this.fb_y, 0.0D, 1000.0D, 3000.0D);
|
||||
GL11.glMatrixMode(5888);
|
||||
GL11.glLoadIdentity();
|
||||
GL11.glTranslatef(0.0F, 0.0F, -2000.0F);
|
||||
}
|
||||
|
||||
public void run() {
|
||||
start = WCF.getTime();
|
||||
start = Window.getTime();
|
||||
Log.SYSTEM.info("Java " + System.getProperty("java.version"));
|
||||
Log.SYSTEM.info(Config.VERSION);
|
||||
if(!WCF.createWindow(Config.VERSION, System.getProperty("opengl.debug") != null))
|
||||
if(!Window.createWindow(Config.VERSION, System.getProperty("opengl.debug") != null))
|
||||
System.exit(1);
|
||||
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("OpenGL %s", GL11.glGetString(GL11.GL_VERSION));
|
||||
Log.SYSTEM.info("GL_VENDOR: %s", GL11.glGetString(GL11.GL_VENDOR));
|
||||
Log.SYSTEM.info("GL_RENDERER: %s", GL11.glGetString(GL11.GL_RENDERER));
|
||||
Log.SYSTEM.info("Starte ...");
|
||||
|
||||
this.init();
|
||||
|
@ -2034,9 +2034,9 @@ public class Game implements IThreadListener {
|
|||
GlState.enableBlend();
|
||||
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);
|
||||
WCF.setIcon(genTriwave(64, 64, 0x00000000, 0xffff0000, 0xff00ff00, 0xff0000ff, 0xff7f00ff, 0xff000000), 64, 64);
|
||||
this.vidMode = Window.getDisplayMode();
|
||||
Window.initWindow(this.saved_xpos, this.saved_ypos, this.xsize, this.ysize);
|
||||
Window.setIcon(genTriwave(64, 64, 0x00000000, 0xffff0000, 0xff00ff00, 0xff0000ff, 0xff7f00ff, 0xff000000), 64, 64);
|
||||
this.sync(this.sync);
|
||||
this.startSound(true);
|
||||
this.getVar("tic_target").setDefault();
|
||||
|
@ -2075,8 +2075,8 @@ public class Game implements IThreadListener {
|
|||
this.finish();
|
||||
PerfSection.SWAP.enter();
|
||||
if(this.glFlush)
|
||||
WCF.glFlush();
|
||||
WCF.swapBuffers();
|
||||
GL11.glFlush();
|
||||
Window.swapBuffers();
|
||||
PerfSection.EVENTS.enter();
|
||||
Log.flushLog();
|
||||
this.poll();
|
||||
|
@ -2097,7 +2097,7 @@ public class Game implements IThreadListener {
|
|||
Log.flushLog();
|
||||
this.save();
|
||||
Font.unload();
|
||||
WCF.destroyWindow();
|
||||
Window.destroyWindow();
|
||||
Log.SYSTEM.info("Beendet.");
|
||||
}
|
||||
|
||||
|
@ -2175,7 +2175,7 @@ public class Game implements IThreadListener {
|
|||
this.saving = true;
|
||||
final int stride = ((this.fb_x * 3) & 3) != 0 ? 4 + ((this.fb_x * 3) & ~3) : (this.fb_x * 3);
|
||||
final ByteBuffer data = ByteBuffer.allocateDirect(stride * this.fb_y).order(ByteOrder.nativeOrder());
|
||||
WCF.glReadPixels(this.fb_x, this.fb_y, data);
|
||||
GL11.glReadPixels(0, 0, this.fb_x, this.fb_y, GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, data);
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
byte[] pixels = new byte[stride * Game.this.fb_y];
|
||||
|
@ -2340,7 +2340,7 @@ public class Game implements IThreadListener {
|
|||
}
|
||||
|
||||
public long rtime() {
|
||||
return WCF.getTime() - start;
|
||||
return Window.getTime() - start;
|
||||
}
|
||||
|
||||
public double ftime() {
|
||||
|
@ -2551,7 +2551,7 @@ public class Game implements IThreadListener {
|
|||
|
||||
|
||||
public static void main(String[] args) {
|
||||
WCF.init();
|
||||
Window.init();
|
||||
Locale.setDefault(Locale.ROOT);
|
||||
Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler() {
|
||||
public void uncaughtException(Thread thread, Throwable e) {
|
||||
|
@ -2649,7 +2649,7 @@ public class Game implements IThreadListener {
|
|||
});
|
||||
Thread.currentThread().setName("Render thread");
|
||||
INSTANCE.run();
|
||||
WCF.end();
|
||||
Window.end();
|
||||
}
|
||||
|
||||
|
||||
|
@ -3001,21 +3001,21 @@ public class Game implements IThreadListener {
|
|||
private void renderWorldDirections(float partialTicks) {
|
||||
GlState.enableBlend();
|
||||
GlState.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||
WCF.glLineWidth(1.0F);
|
||||
GL11.glLineWidth(1.0F);
|
||||
GlState.disableTexture2D();
|
||||
GlState.depthMask(false);
|
||||
// GlState.color(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
WCF.glPushMatrix();
|
||||
GL11.glPushMatrix();
|
||||
// WCF.glMatrixMode(5888);
|
||||
// WCF.glLoadIdentity();
|
||||
WCF.glTranslatef(this.fb_x / 2, this.fb_y / 2, 0.0F);
|
||||
GL11.glTranslatef((float)(this.fb_x / 2), (float)(this.fb_y / 2), 0.0F);
|
||||
this.entityRenderer.rotateCamera(this.viewEntity, partialTicks);
|
||||
// WCF.glScalef(-1.0f, -1.0f, -1.0f);
|
||||
// Drawing.drawRectColor(0, 0, 10, 2, 0xff00ff00);
|
||||
RenderGlobal.drawOutlinedBoundingBox(new BoundingBox(0.0D, 0.0D, 0.0D, 24D, 1D, 1D), 255, 0, 0, 255);
|
||||
RenderGlobal.drawOutlinedBoundingBox(new BoundingBox(0.0D, 0.0D, 0.0D, 1D, 1D, 24D), 0, 0, 255, 255);
|
||||
RenderGlobal.drawOutlinedBoundingBox(new BoundingBox(0.0D, 0.0D, 0.0D, 1D, -20D, 1D), 0, 255, 0, 255);
|
||||
WCF.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
GlState.depthMask(true);
|
||||
GlState.enableTexture2D();
|
||||
GlState.disableBlend();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue