more Java, less Scala. Fixed 1 slider derp. Still need to fix name labels.

This commit is contained in:
Leon 2016-10-20 08:24:52 -04:00
parent c30e77e3d4
commit c85f95f6c3
14 changed files with 253 additions and 404 deletions

View file

@ -0,0 +1,152 @@
package net.machinemuse.general.gui.clickable;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import net.machinemuse.numina.geometry.Colour;
import net.machinemuse.numina.geometry.MusePoint2D;
import net.machinemuse.numina.network.PacketSender;
import net.machinemuse.powersuits.common.Config;
import net.machinemuse.powersuits.control.KeybindManager;
import net.machinemuse.powersuits.network.packets.MusePacketToggleRequest;
import net.machinemuse.utils.MuseItemUtils;
import net.machinemuse.utils.MuseStringUtils;
import net.machinemuse.utils.render.MuseRenderer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.util.ChatComponentText;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* Ported to Java by lehjr on 10/19/16.
*/
public class ClickableKeybinding extends ClickableButton {
protected List<ClickableModule> boundModules = new ArrayList<ClickableModule>();
public boolean toggleval = false;
public boolean toggled = false;
public Boolean displayOnHUD;
public KeyBinding keybind;
public ClickableKeybinding(KeyBinding keybind, MusePoint2D position, boolean free, Boolean displayOnHUD) {
super((keybind.getKeyCode() < 0)? ("Mouse" + (keybind.getKeyCode() + 100)) : Keyboard.getKeyName(keybind.getKeyCode()), position, true);
this.displayOnHUD = (displayOnHUD != null) ? displayOnHUD : false;
this.keybind = keybind;
}
public String parseName(KeyBinding keybind) {
if (keybind.getKeyCode() < 0) {
return "Mouse" + (keybind.getKeyCode() + 100);
}
else {
return Keyboard.getKeyName(keybind.getKeyCode());
}
}
public void doToggleTick() {
doToggleIf(keybind.getIsKeyPressed());
}
public void doToggleIf(boolean value) {
if (value && !toggled) {
toggleModules();
KeybindManager.writeOutKeybinds();
}
toggled = value;
}
public void toggleModules() {
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
if (player == null) {
return;
}
for (ClickableModule module : boundModules) {
String valstring = (toggleval) ? " on" : " off";
if ((FMLCommonHandler.instance().getEffectiveSide().equals(Side.CLIENT) && Config.toggleModuleSpam())) {
player.addChatMessage(new ChatComponentText("Toggled " + module.getModule().getDataName() + valstring));
}
MuseItemUtils.toggleModuleForPlayer(player, module.getModule().getDataName(), toggleval);
MusePacketToggleRequest toggleRequest = new MusePacketToggleRequest(player, module.getModule().getDataName(), toggleval);
PacketSender.sendToServer(toggleRequest);
}
toggleval = !toggleval;
}
@Override
public void draw() {
super.draw();
for (ClickableModule module : boundModules) {
MuseRenderer.drawLineBetween(this, module, Colour.LIGHTBLUE);
GL11.glPushMatrix();
GL11.glScaled(0.5, 0.5, 0.5);
if (displayOnHUD) {
MuseRenderer.drawString(MuseStringUtils.wrapFormatTags("HUD", MuseStringUtils.FormatCodes.BrightGreen), this.position.x()*2 + 6,this.position.y()*2 + 6);
} else {
MuseRenderer.drawString(MuseStringUtils.wrapFormatTags("x", MuseStringUtils.FormatCodes.Red), this.position.x()*2 + 6,this.position.y()*2 + 6);
}
GL11.glPopMatrix();
}
}
public KeyBinding getKeyBinding() {
return keybind;
}
public List<ClickableModule> getBoundModules() {
return boundModules;
}
public void bindModule(ClickableModule module) {
if (!boundModules.contains(module)) {
boundModules.add(module);
}
}
public void unbindModule(ClickableModule module) {
boundModules.remove(module);
}
public void unbindFarModules() {
Iterator<ClickableModule> iterator = boundModules.iterator();
ClickableModule module = null;
while (iterator.hasNext()) {
module = iterator.next();
int maxDistance = getTargetDistance() * 2;
double distanceSq = module.getPosition().distanceSq(this.getPosition());
if (distanceSq > maxDistance * maxDistance) {
iterator.remove();
}
}
}
public int getTargetDistance() {
return (boundModules.size() > 6) ? (16 + (boundModules.size() - 6) * 3) : 16;
}
public void attractBoundModules(IClickable exception) {
for (ClickableModule module : boundModules) {
if (!module.equals(exception)) {
MusePoint2D euclideanDistance = module.getPosition().minus(this.getPosition());
MusePoint2D directionVector = euclideanDistance.normalize();
MusePoint2D tangentTarget = directionVector.times(getTargetDistance()).plus(this.getPosition());
MusePoint2D midpointTangent = module.getPosition().midpoint(tangentTarget);
module.move(midpointTangent.x(), midpointTangent.y());
}
}
}
public boolean equals(ClickableKeybinding other) {
return other.keybind.getKeyCode() == this.keybind.getKeyCode();
}
public void toggleHUDState (){
displayOnHUD = !displayOnHUD;
}
}

View file

@ -4,14 +4,14 @@ import java.util.List;
public interface IGuiFrame {
public abstract void onMouseDown(double x, double y, int button);
void onMouseDown(double x, double y, int button);
public abstract void onMouseUp(double x, double y, int button);
void onMouseUp(double x, double y, int button);
public abstract void update(double mousex, double mousey);
void update(double mousex, double mousey);
public abstract void draw();
void draw();
public abstract List<String> getToolTip(int x, int y);
List<String> getToolTip(int x, int y);
}

View file

@ -62,7 +62,7 @@ public class KeybindManager {
writer = new BufferedWriter(new FileWriter(file));
List<IPowerModule> modulesToWrite = MuseItemUtils.getPlayerInstalledModules(Minecraft.getMinecraft().thePlayer);
for (ClickableKeybinding keybinding : getInstance().keybindings) {
writer.write(keybinding.getKeyBinding().getKeyCode() + ":" + keybinding.getPosition().x() + ':' + keybinding.getPosition().y() + ':' + keybinding.displayOnHUD() + ':' + keybinding.toggleval() + '\n');
writer.write(keybinding.getKeyBinding().getKeyCode() + ":" + keybinding.getPosition().x() + ':' + keybinding.getPosition().y() + ':' + keybinding.displayOnHUD + ':' + keybinding.toggleval + '\n');
for (ClickableModule module : keybinding.getBoundModules()) {
writer.write(module.getModule().getDataName() + '~' + module.getPosition().x() + '~' + module.getPosition().y() + '\n');
}
@ -104,7 +104,7 @@ public class KeybindManager {
toggleval = Boolean.parseBoolean(exploded[4]);
}
workingKeybinding = new ClickableKeybinding(new KeyBinding(Keyboard.getKeyName(id), id, KeybindKeyHandler.mps), position, free, displayOnHUD);
workingKeybinding.toggleval_$eq(toggleval);
workingKeybinding.toggleval = toggleval;
getInstance().keybindings.add(workingKeybinding);
} else {
workingKeybinding = null;

View file

@ -1,146 +0,0 @@
package net.machinemuse.general.gui.clickable
import cpw.mods.fml.common.FMLCommonHandler
import cpw.mods.fml.relauncher.Side
import net.machinemuse.numina.geometry.Colour
import net.machinemuse.numina.geometry.MusePoint2D
import net.machinemuse.numina.network.PacketSender
import net.machinemuse.powersuits.common.Config
import net.machinemuse.powersuits.control.KeybindManager
import net.machinemuse.powersuits.network.packets.MusePacketToggleRequest
import net.machinemuse.utils.{MuseStringUtils, MuseItemUtils}
import net.machinemuse.utils.MuseStringUtils.FormatCodes
import net.machinemuse.utils.render.{GuiIcons, MuseRenderer}
import net.minecraft.client.Minecraft
import net.minecraft.client.entity.EntityClientPlayerMP
import net.minecraft.client.settings.KeyBinding
import net.minecraft.util.ChatComponentText
import org.lwjgl.input.Keyboard
import java.util.ArrayList
import java.util.Iterator
import java.util.List
import org.lwjgl.opengl.GL11
object ClickableKeybinding {
def parseName(keybind: KeyBinding): String = {
if (keybind.getKeyCode < 0) {
return "Mouse" + (keybind.getKeyCode + 100)
}
else {
return Keyboard.getKeyName(keybind.getKeyCode)
}
}
}
class ClickableKeybinding(val keybind: KeyBinding, position: MusePoint2D, val free: Boolean, var displayOnHUD: Boolean = false) extends ClickableButton(ClickableKeybinding.parseName(keybind), position, true) {
protected var boundModules: List[ClickableModule] = new ArrayList[ClickableModule]
var toggleval: Boolean = false
var toggled: Boolean = false
def doToggleTick {
doToggleIf(keybind.getIsKeyPressed)
}
def doToggleIf(value: Boolean) {
if (value && !toggled) {
toggleModules()
KeybindManager.writeOutKeybinds()
}
toggled = value
}
def toggleModules() {
val player: EntityClientPlayerMP = Minecraft.getMinecraft.thePlayer
if (player == null) {
return
}
import scala.collection.JavaConversions._
for (module <- boundModules) {
val valstring: String = if (toggleval) " on" else " off"
if ((FMLCommonHandler.instance.getEffectiveSide eq Side.CLIENT) && Config.toggleModuleSpam) {
player.addChatMessage(new ChatComponentText("Toggled " + module.getModule.getDataName + valstring))
}
MuseItemUtils.toggleModuleForPlayer(player, module.getModule.getDataName, toggleval)
val toggleRequest: MusePacketToggleRequest = new MusePacketToggleRequest(player, module.getModule.getDataName, toggleval)
PacketSender.sendToServer(toggleRequest)
}
toggleval = !toggleval
}
override def draw() {
super.draw()
import scala.collection.JavaConversions._
for (module <- boundModules) {
MuseRenderer.drawLineBetween(this, module, Colour.LIGHTBLUE)
GL11.glPushMatrix()
GL11.glScaled(0.5, 0.5, 0.5)
if (displayOnHUD) {
MuseRenderer.drawString(MuseStringUtils.wrapFormatTags("HUD", FormatCodes.BrightGreen), this.position.x*2 + 6,this.position.y*2 + 6)
} else {
MuseRenderer.drawString(MuseStringUtils.wrapFormatTags("x", FormatCodes.Red), this.position.x*2 + 6,this.position.y*2 + 6)
}
GL11.glPopMatrix()
}
}
def getKeyBinding: KeyBinding = {
return keybind
}
def getBoundModules: List[ClickableModule] = {
return boundModules
}
def bindModule(module: ClickableModule) {
if (!boundModules.contains(module)) {
boundModules.add(module)
}
}
def unbindModule(module: ClickableModule) {
boundModules.remove(module)
}
def unbindFarModules {
val iterator: Iterator[ClickableModule] = boundModules.iterator
var module: ClickableModule = null
while (iterator.hasNext) {
module = iterator.next
val maxDistance: Int = getTargetDistance * 2
val distanceSq: Double = module.getPosition.distanceSq(this.getPosition)
if (distanceSq > maxDistance * maxDistance) {
iterator.remove
}
}
}
def getTargetDistance: Int = {
if (boundModules.size > 6) {
16 + (boundModules.size - 6) * 3
} else {
16
}
}
def attractBoundModules(exception: IClickable) {
import scala.collection.JavaConversions._
for (module <- boundModules) {
if (module ne exception) {
val euclideanDistance: MusePoint2D = module.getPosition.minus(this.getPosition)
val directionVector: MusePoint2D = euclideanDistance.normalize
val tangentTarget: MusePoint2D = directionVector.times(getTargetDistance).plus(this.getPosition)
val midpointTangent: MusePoint2D = module.getPosition.midpoint(tangentTarget)
module.move(midpointTangent.x, midpointTangent.y)
}
}
}
def equals(other: ClickableKeybinding): Boolean = {
return other.keybind.getKeyCode == this.keybind.getKeyCode
}
def toggleHUDState {
displayOnHUD = !displayOnHUD
}
}

View file

@ -25,14 +25,11 @@ import java.util.List;
public class ClickableModule extends Clickable {
IPowerModule module;
public ClickableModule(IPowerModule module , MusePoint2D position) {
super(position);
this.module = module;
}
boolean allowed = true;
boolean installed = false;
Colour checkmarkcolour = new Colour(0.0F, 0.667F, 0.0F, 1.0F);

View file

@ -1,85 +0,0 @@
//package net.machinemuse.general.gui.clickable
//
//import net.machinemuse.api.{ILocalizeableModule, IPowerModule}
//import net.machinemuse.utils.render.{MuseRenderer, GuiIcons}
//import GuiIcons.Checkmark
//import net.machinemuse.utils.MuseStringUtils
//import java.util.ArrayList
//import java.util.List
//import net.machinemuse.numina.geometry.{Colour, MusePoint2D}
//import net.machinemuse.numina.render.{MuseIconUtils, MuseTextureUtils}
//import net.minecraft.util.StatCollector
//
///**
// * Extends the Clickable class to make a clickable Augmentation; note that this
// * will not be an actual item.
// *
// * @author MachineMuse
// */
//class ClickableModule(val module: IPowerModule, position: MusePoint2D) extends Clickable(position) {
// var allowed: Boolean = true
// var installed: Boolean = false
// val checkmarkcolour = new Colour(0.0F, 0.667F, 0.0F, 1.0F)
//
// override def getToolTip: List[String] = {
// val toolTipText: List[String] = new ArrayList[String]
// toolTipText.add(getLocalizedName(getModule))
// toolTipText.addAll(MuseStringUtils.wrapStringToLength(getLocalizedDescription(getModule), 30))
// toolTipText
// }
// def getLocalizedName(m:IPowerModule): String = {
// m match {
// case m:ILocalizeableModule => StatCollector.translateToLocal("module." + m.getUnlocalizedName + ".name")
// case m => m.getLocalizedName
// }
// }
//
// def getLocalizedDescription(m:IPowerModule): String = {
// m match {
// case m:ILocalizeableModule => StatCollector.translateToLocal("module." + m.getUnlocalizedName + ".desc")
// case m => m.getDescription
// }
// }
//
// def draw {
// val k: Double = Integer.MAX_VALUE
// val left: Double = getPosition.x - 8
// val top: Double = getPosition.y - 8
// drawPartial(left, top, left + 16, top + 16)
// }
//
// def drawPartial(xmino: Double, ymino: Double, xmaxo: Double, ymaxo: Double) {
// val left: Double = getPosition.x - 8
// val top: Double = getPosition.y - 8
// MuseTextureUtils.pushTexture(getModule.getStitchedTexture(null))
// MuseIconUtils.drawIconAt(left, top, getModule.getIcon(null), Colour.WHITE)
// MuseTextureUtils.popTexture()
// if (!allowed) {
// val string: String = MuseStringUtils.wrapFormatTags("x", MuseStringUtils.FormatCodes.DarkRed)
// MuseRenderer.drawString(string, getPosition.x + 3, getPosition.y + 1)
// }
// else if (installed) {
// Checkmark(getPosition.x - 8 + 1, getPosition.y - 8 + 1, c = checkmarkcolour)
// }
// }
//
// def hitBox(x: Double, y: Double): Boolean = {
// val hitx: Boolean = Math.abs(x - getPosition.x) < 8
// val hity: Boolean = Math.abs(y - getPosition.y) < 8
// hitx && hity
// }
//
// def getModule: IPowerModule = module
//
// def equals(other: ClickableModule): Boolean = this.module == other.getModule
//
//
// def setAllowed(allowed: Boolean) {
// this.allowed = allowed
// }
//
// def setInstalled(installed: Boolean) {
// this.installed = installed
// }
//
//}

View file

@ -16,20 +16,26 @@ public class ClickableSlider extends Clickable {
public static MusePoint2D pos;
public static double width;
public static String name;
public static int cornersize = 3;
DrawableMuseRect insideRect;
DrawableMuseRect outsideRect;
public ClickableSlider(MusePoint2D pos, double width, String name) {
this.pos = pos;
this.width = width;
this.name = name;
this.position = pos;
}
public static int cornersize = 3;
DrawableMuseRect insideRect = new DrawableMuseRect(position.x() - width / 2.0 - cornersize, position.y() + 8, 0, position.y() + 16, Colour.LIGHTBLUE, Colour.ORANGE);
DrawableMuseRect outsideRect = new DrawableMuseRect(position.x() - width / 2.0 - cornersize, position.y() + 8, position.x() + width / 2.0 + cornersize, position.y() + 16, Colour.LIGHTBLUE, Colour.DARKBLUE);
insideRect = new DrawableMuseRect(position.x() - width / 2.0 - cornersize, position.y() + 8, 0, position.y() + 16, Colour.LIGHTBLUE, Colour.ORANGE);
outsideRect = new DrawableMuseRect(position.x() - width / 2.0 - cornersize, position.y() + 8, position.x() + width / 2.0 + cornersize, position.y() + 16, Colour.LIGHTBLUE, Colour.DARKBLUE);
System.out.println("===========================================================");
System.out.println("name: " + name);
System.out.println("pos.x: " + pos.x());
System.out.println("pos.y: " + pos.y());
System.out.println("============================================================");
}
double valueInternal = 0;

View file

@ -11,6 +11,7 @@ public class ClickableTinkerSlider extends ClickableSlider {
MusePoint2D topmiddle;
double width;
NBTTagCompound moduleTag;
public String name;
public ClickableTinkerSlider(MusePoint2D topmiddle, double width, NBTTagCompound moduleTag, String name) {
super(topmiddle, width, name);
@ -18,6 +19,15 @@ public class ClickableTinkerSlider extends ClickableSlider {
this.topmiddle = topmiddle;
this.width = width;
this.moduleTag = moduleTag;
System.out.println("===========================================================");
System.out.println("name: " + this.name);
System.out.println("pos.x: " + pos.x());
System.out.println("pos.y: " + pos.y());
System.out.println("============================================================");
}
@Override
@ -30,4 +40,5 @@ public class ClickableTinkerSlider extends ClickableSlider {
double xratio = MuseMathUtils.clampDouble(0.5 - (xval / width), 0, 1);
moduleTag.setDouble(name, xratio);
}
}

View file

@ -96,12 +96,6 @@ class PartManipSubFrame(val model: ModelSpec, val colourframe: ColourPickerFrame
val tag = getSpecTag(spec)
val selcomp = if (tag.hasNoTags) 0 else if (spec.getGlow(tag)) 2 else 1
val selcolour = spec.getColourIndex(tag)
// new GuiIcon (double x, double y, Colour c, Double xmin, Double ymin, Double xmax, Double ymax) // FIXME!!!
new GuiIcons.TransparentArmor(x, y, null, null, ymino, null, ymaxo);
new GuiIcons.NormalArmor(x + 8, y, null, null, ymino, null, ymaxo);
new GuiIcons.GlowArmor(x + 16, y, null, null, ymino, null, ymaxo);

View file

@ -0,0 +1,70 @@
package net.machinemuse.general.gui.frame;
import net.machinemuse.general.gui.clickable.ClickableButton;
import net.machinemuse.numina.geometry.MusePoint2D;
import net.machinemuse.powersuits.common.ModularPowersuits;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.StatCollector;
import java.util.*;
/**
* @author MachineMuse
*
* Ported to Java by lehjr on 10/19/16.
*/
public class TabSelectFrame implements IGuiFrame {
EntityPlayer p;
MusePoint2D topleft;
MusePoint2D bottomright;
int worldx;
int worldy;
int worldz;
Map<ClickableButton, Integer> buttons = new HashMap<>();
public TabSelectFrame(EntityPlayer p, MusePoint2D topleft, MusePoint2D bottomright, int worldx, int worldy, int worldz) {
this.p = p;
this.topleft = topleft;
this.bottomright = bottomright;
this.worldx = worldx;
this.worldy = worldy;
this.worldz = worldz;
this.buttons.put(new ClickableButton(StatCollector.translateToLocal("gui.tab.tinker"), topleft.midpoint(bottomright).minus(100, 0), worldy < 256 && worldy > 0), 0);
this.buttons.put(new ClickableButton(StatCollector.translateToLocal("gui.tab.keybinds"), topleft.midpoint(bottomright), true), 1);
this.buttons.put(new ClickableButton(StatCollector.translateToLocal("gui.tab.visual"), topleft.midpoint(bottomright).plus(100, 0), true), 3);
}
@Override
public void onMouseDown(double x, double y, int button) {
for (ClickableButton b : buttons.keySet()) {
if (b.isEnabled() && b.hitBox(x, y)) {
p.openGui(ModularPowersuits.INSTANCE(), buttons.get(b), p.worldObj, worldx, worldy, worldz);
}
}
}
@Override
public void onMouseUp(double x, double y, int button) {
}
@Override
public void update(double mousex, double mousey) {
}
@Override
public void draw() {
for (ClickableButton b : buttons.keySet())
b.draw();
}
List<String> toolTip = new ArrayList<String>();
@Override
public List<String> getToolTip(int x, int y) {
return null;
}
}

View file

@ -1,41 +0,0 @@
package net.machinemuse.general.gui.frame
import net.machinemuse.numina.geometry.MusePoint2D
import java.util
import net.machinemuse.general.gui.clickable.ClickableButton
import net.minecraft.entity.player.EntityPlayer
import net.machinemuse.powersuits.common.ModularPowersuits
import net.minecraft.util.StatCollector
/**
* @author MachineMuse
*/
class TabSelectFrame(p: EntityPlayer, topleft: MusePoint2D, bottomright: MusePoint2D,
worldx: Int, worldy: Int, worldz: Int)
extends IGuiFrame {
val buttons = Array(
(new ClickableButton(StatCollector.translateToLocal("gui.tab.tinker"), topleft.midpoint(bottomright).minus(100, 0), worldy < 256 && worldy > 0), 0),
(new ClickableButton(StatCollector.translateToLocal("gui.tab.keybinds"), topleft.midpoint(bottomright), true), 1),
(new ClickableButton(StatCollector.translateToLocal("gui.tab.visual"), topleft.midpoint(bottomright).plus(100, 0), true), 3)
)
def onMouseDown(x: Double, y: Double, button: Int): Unit = {
for (b <- buttons) {
if (b._1.isEnabled && b._1.hitBox(x, y)) {
p.openGui(ModularPowersuits, b._2, p.worldObj, worldx, worldy, worldz)
}
}
}
def onMouseUp(x: Double, y: Double, button: Int): Unit = {}
def update(mousex: Double, mousey: Double): Unit = {}
def draw(): Unit = for (b <- buttons) {
b._1.draw()
}
val toolTip = new util.ArrayList[String]()
def getToolTip(x: Int, y: Int): util.List[String] = null
}

View file

@ -1,20 +0,0 @@
//package net.machinemuse.utils.render
//
//import org.lwjgl.opengl.GL11._
//
///**
// * Author: MachineMuse (Claire Semple)
// * Created: 5:00 PM, 5/15/13
// */
//object MuseStencilManager {
// val stencilMask = 0x10
//
// def stencilOn() {
// glStencilMask(stencilMask)
// glEnable(GL_STENCIL)
// }
//
// def stencilOff() {
//
// }
//}

View file

@ -1,9 +0,0 @@
//package net.machinemuse.utils.render
//
///**
// * Author: MachineMuse (Claire Semple)
// * Created: 6:28 PM, 5/15/13
// */
//class MuseTexture {
//
//}

View file

@ -1,80 +0,0 @@
//package net.machinemuse.utils.render
//
//import org.lwjgl.opengl.GLContext
//import java.nio.ByteBuffer
//import org.lwjgl.opengl.EXTFramebufferObject._
//import org.lwjgl.opengl.GL11._
//import org.lwjgl.opengl.GL14._
//
///**
// * Author: MachineMuse (Claire Semple)
// * Created: 8:18 PM, 5/15/13
// */
//class TextureBuffer(val texDimension: Int) {
// // check if FBO is enabled
// if (!GLContext.getCapabilities.GL_EXT_framebuffer_object) {
// throw new RuntimeException("Framebuffers not supported!")
// }
//
// // Allocate IDs for a FBO, colour buffer, and depth buffer
// val framebufferID = glGenFramebuffersEXT()
// val colorTextureID = glGenTextures()
// val depthRenderBufferID = glGenTextures()
//
// glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, framebufferID)
//
// glBindTexture(GL_TEXTURE_2D, colorTextureID)
// glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
// glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
// glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, texDimension, texDimension, 0, GL_RGBA, GL_INT, null: ByteBuffer)
// glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, colorTextureID, 0)
//
// glBindTexture(GL_TEXTURE_2D, depthRenderBufferID)
// glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
// glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
// glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, texDimension, texDimension, 0, GL_DEPTH_COMPONENT, GL_INT, null: ByteBuffer)
// glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, depthRenderBufferID, 0)
//
//
// // Check the status and throw an exception if it didn't initialize properly
// glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) match {
// case GL_FRAMEBUFFER_COMPLETE_EXT =>
// case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT => throw new RuntimeException("FrameBuffer: " + framebufferID + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT exception")
// case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT => throw new RuntimeException("FrameBuffer: " + framebufferID + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT exception")
// case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT => throw new RuntimeException("FrameBuffer: " + framebufferID + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT exception")
// case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT => throw new RuntimeException("FrameBuffer: " + framebufferID + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT exception")
// case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT => throw new RuntimeException("FrameBuffer: " + framebufferID + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT exception")
// case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT => throw new RuntimeException("FrameBuffer: " + framebufferID + ", has caused a GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT exception")
// case x => throw new RuntimeException("Unexpected reply from glCheckFramebufferStatusEXT: " + x)
// }
//
// // Bind the display buffer
// glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0)
//
// def bindRead() {
// glPushAttrib(GL_TEXTURE_BIT)
// glBindTexture(GL_TEXTURE_2D, colorTextureID)
// }
//
// def unbindRead() {
// glPopAttrib()
// }
//
// def bindWrite() {
// glPushAttrib(GL_VIEWPORT_BIT)
// glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, framebufferID)
// glViewport(0, 0, texDimension, texDimension)
// }
//
// def unbindWrite() {
// glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0)
// glPopAttrib()
// }
//
//
// def clear() {
// bindWrite()
// glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
// unbindWrite()
// }
//}