framebuffer bug hunt work
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2024-09-06 01:32:25 -04:00
parent 5cce5e5ac1
commit df3010f38a
7 changed files with 252 additions and 53 deletions

View File

@ -434,8 +434,6 @@ public class Main {
//
//Terminate the program.
if(Globals.renderingEngine != null){
glfwTerminate();
Globals.renderingEngine.clearGlobalState();
Globals.renderingEngine.destroy();
}
//used to signal threads to stop

View File

@ -153,6 +153,21 @@ public class OpenGLState {
}
}
/**
* Binds a texture to a given texture unit if the texture hasn't already been bound to that unit
* @param textureUnit The texture unit
* @param texturePointer The texture pointer
* @param textureType the type of texture (2d, 3d, etc)
*/
public void glBindTextureUnitForce(int textureUnit, int texturePointer, int textureType){
unitToPointerMap.put(textureUnit,texturePointer);
this.activeTexture = textureUnit;
GL40.glActiveTexture(this.activeTexture);
Globals.renderingEngine.checkError();
GL40.glBindTexture(textureType,texturePointer);
Globals.renderingEngine.checkError();
}
/**
* Binds a framebuffer
* @param framebufferType the type of framebuffer (vanilla, renderbuffer, etc)

View File

@ -38,6 +38,11 @@ import org.lwjgl.glfw.GLFWErrorCallback;
import org.lwjgl.opengl.GL;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL30;
import org.lwjgl.opengl.GL45;
import org.lwjgl.opengl.GLCapabilities;
import org.lwjgl.opengl.GLDebugMessageCallback;
import org.lwjgl.system.MemoryStack;
import org.lwjgl.system.NativeType;
import electrosphere.engine.Globals;
import electrosphere.logger.LoggerInterface;
@ -186,12 +191,18 @@ public class RenderingEngine {
//
//set error callback
GLFW.glfwSetErrorCallback(GLFWErrorCallback.createThrow());
// GLFWErrorCallback
GLFW.glfwSetErrorCallback((int error, long descriptionPtr) -> {
String description = GLFWErrorCallback.getDescription(descriptionPtr);
System.err.println(description);
});
//Initializes opengl
boolean glfwInited = glfwInit();
if(!glfwInited){
throw new IllegalStateException("Failed to initialize glfw!");
String message = "Failed to initialize glfw!\n" +
"Error code: " + this.getGLFWErrorMessage(this.getGLFWError());
throw new IllegalStateException(message);
}
//Gives hints to glfw to control how opengl will be used
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
@ -216,9 +227,13 @@ public class RenderingEngine {
}
// Errors for failure to create window (IE: No GUI mode on linux ?)
if (Globals.window == NULL) {
LoggerInterface.loggerEngine.ERROR("Failed to make window.", new Exception("Renderer Creation Failure"));
String message = "Failed to create window!\n" +
"Error code: " + this.getGLFWErrorMessage(this.getGLFWError());
;
LoggerInterface.loggerEngine.ERROR(new Exception(message));
glfwTerminate();
}
//set resize callback
GLFW.glfwSetWindowSizeCallback(Globals.window, (long window, int width, int height) -> {
Globals.WINDOW_HEIGHT = height;
@ -228,6 +243,7 @@ public class RenderingEngine {
glfwMakeContextCurrent(Globals.window);
//Maximize it
glfwMaximizeWindow(Globals.window);
GLFW.glfwPollEvents();
//grab actual framebuffer
IntBuffer xBuffer = BufferUtils.createIntBuffer(1);
IntBuffer yBuffer = BufferUtils.createIntBuffer(1);
@ -255,8 +271,17 @@ public class RenderingEngine {
//get title bar dimensions
// setTitleBarDimensions();
//Creates the OpenGL capabilities for the program.
GL.createCapabilities();
//Creates the OpenGL capabilities for the program.)
GLCapabilities glCapabilities = GL.createCapabilities();
GL45.glEnable(GL45.GL_DEBUG_OUTPUT);
//register error callback
GL45.glDebugMessageCallback((int source, int type, int id, int severity, int length, long messagePtr, long userParam) -> {
if(type == GL45.GL_DEBUG_TYPE_ERROR){
String message = GLDebugMessageCallback.getMessage(length, messagePtr);
System.err.println(message);
}
}, bufferHeight);
//get environment constraints
openGLState.storeCurrentEnvironmentContraints();
@ -290,11 +315,16 @@ public class RenderingEngine {
//default framebuffer
defaultFramebuffer = new Framebuffer(GL_DEFAULT_FRAMEBUFFER);
defaultFramebuffer.bind(openGLState);
//generate framebuffers
screenTextureColor = FramebufferUtils.generateScreenTextureColorAlpha(openGLState, Globals.WINDOW_WIDTH, Globals.WINDOW_HEIGHT);
screenTextureDepth = FramebufferUtils.generateScreenTextureDepth(openGLState, Globals.WINDOW_WIDTH, Globals.WINDOW_HEIGHT);
screenFramebuffer = FramebufferUtils.generateScreenTextureFramebuffer(openGLState, Globals.WINDOW_WIDTH, Globals.WINDOW_HEIGHT, screenTextureColor, screenTextureDepth);
Texture screenTextureColor = FramebufferUtils.generateScreenTextureColorAlpha(openGLState, Globals.WINDOW_WIDTH, Globals.WINDOW_HEIGHT);
RenderingEngine.screenTextureColor = screenTextureColor;
Texture screenTextureDepth = FramebufferUtils.generateScreenTextureDepth(openGLState, Globals.WINDOW_WIDTH, Globals.WINDOW_HEIGHT);
RenderingEngine.screenTextureDepth = screenTextureDepth;
Framebuffer screenFramebuffer = FramebufferUtils.generateScreenTextureFramebuffer(openGLState, Globals.WINDOW_WIDTH, Globals.WINDOW_HEIGHT, screenTextureColor, screenTextureDepth);
RenderingEngine.screenFramebuffer = screenFramebuffer;
defaultFramebuffer.bind(openGLState);
glBindRenderbuffer(GL_RENDERBUFFER, GL_DEFAULT_RENDERBUFFER);
Globals.renderingEngine.checkError();
@ -309,8 +339,10 @@ public class RenderingEngine {
//
lightDepthShaderProgram = ShaderProgram.loadSpecificShader("/Shaders/core/lightDepth/lightDepth.vs", "/Shaders/core/lightDepth/lightDepth.fs");
Globals.depthMapShaderProgramLoc = lightDepthShaderProgram.getShaderId();
lightDepthBuffer = FramebufferUtils.generateDepthBuffer(openGLState);
lightBufferDepthTexture = lightDepthBuffer.getDepthTexture();
Framebuffer lightDepthBuffer = FramebufferUtils.generateDepthBuffer(openGLState);
RenderingEngine.lightDepthBuffer = lightDepthBuffer;
Texture lightBufferDepthTexture = lightDepthBuffer.getDepthTexture();
RenderingEngine.lightBufferDepthTexture = lightBufferDepthTexture;
// glEnable(GL_CULL_FACE); // enabled for shadow mapping
//
@ -409,15 +441,6 @@ public class RenderingEngine {
Globals.projectionMatrix.setPerspective(verticalFOV, Globals.aspectRatio, nearClip, Globals.userSettings.getGraphicsViewDistance());
Globals.viewMatrix.translation(new Vector3f(0.0f,0.0f,-3.0f));
}
/**
* Clears global, static state
*/
public void clearGlobalState(){
screenTextureColor = null;
screenTextureDepth = null;
screenFramebuffer = null;
}
/**
@ -656,6 +679,34 @@ public class RenderingEngine {
return lastCode;
}
/**
* Gets the most recent GLFW Error
* @return The most recent GLFW error
*/
public int getGLFWError(){
int lastCode = 0;
try (MemoryStack stack = MemoryStack.stackPush()){
lastCode = GLFW.glfwGetError(stack.callocPointer(1));
}
return lastCode;
}
/**
* Decodes the glfw error code
* @param code The code
* @return The decoded message
*/
public String getGLFWErrorMessage(int code){
switch(code){
case GLFW.GLFW_INVALID_ENUM:
return "GLFW_INVALID_ENUM";
case GLFW.GLFW_INVALID_VALUE:
return "GLFW_INVALID_VALUE";
default:
return "Unhandled value!";
}
}
/**
* Checks if pipelines should run
* @return true if should render, false otherwise
@ -671,7 +722,83 @@ public class RenderingEngine {
* Destroys the rendering engine
*/
public void destroy(){
//free framebuffers
if(screenFramebuffer != null){
screenFramebuffer.free();
}
if(screenRenderbuffer != null){
screenRenderbuffer.free();
}
if(gameImageNormalsFramebuffer != null){
gameImageNormalsFramebuffer.free();
}
if(lightDepthBuffer != null){
lightDepthBuffer.free();
}
if(transparencyBuffer != null){
transparencyBuffer.free();
}
if(volumeDepthBackfaceFramebuffer != null){
volumeDepthBackfaceFramebuffer.free();
}
if(volumeDepthFrontfaceFramebuffer != null){
volumeDepthFrontfaceFramebuffer.free();
}
if(normalsOutlineFrambuffer != null){
normalsOutlineFrambuffer.free();
}
//null out
screenFramebuffer = null;
screenRenderbuffer = null;
gameImageNormalsFramebuffer = null;
lightDepthBuffer = null;
transparencyBuffer = null;
volumeDepthBackfaceFramebuffer = null;
volumeDepthFrontfaceFramebuffer = null;
normalsOutlineFrambuffer = null;
//free textures
if(screenTextureColor != null){
screenTextureColor.free();
}
if(screenTextureDepth != null){
screenTextureDepth.free();
}
if(gameImageNormalsTexture != null){
gameImageNormalsTexture.free();
}
if(lightBufferDepthTexture != null){
lightBufferDepthTexture.free();
}
if(transparencyRevealageTexture != null){
transparencyRevealageTexture.free();
}
if(volumeDepthBackfaceTexture != null){
volumeDepthBackfaceTexture.free();
}
if(volumeDepthFrontfaceTexture != null){
volumeDepthFrontfaceTexture.free();
}
if(normalsOutlineTexture != null){
normalsOutlineTexture.free();
}
//null out
screenTextureColor = null;
screenTextureDepth = null;
gameImageNormalsTexture = null;
lightBufferDepthTexture = null;
transparencyRevealageTexture = null;
volumeDepthBackfaceTexture = null;
volumeDepthFrontfaceTexture = null;
normalsOutlineTexture = null;
//end glfw
GLFW.glfwDestroyWindow(Globals.window);
GLFW.glfwTerminate();
}
/**

View File

@ -14,8 +14,12 @@ import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.lwjgl.opengl.GL40;
import org.lwjgl.opengl.GL45;
import org.lwjgl.system.MemoryUtil;
import static org.lwjgl.opengl.GL11.GL_NONE;
import static org.lwjgl.opengl.GL11.GL_TEXTURE;
import static org.lwjgl.opengl.GL30.GL_FRAMEBUFFER;
import static org.lwjgl.opengl.GL45.glCheckNamedFramebufferStatus;
/**
@ -91,29 +95,46 @@ public class Framebuffer {
* Checks if the framebuffer compiled correctly
* @return true if compiled correctly, false otherwise
*/
public boolean isComplete(){
return glCheckNamedFramebufferStatus(framebufferPointer,GL40.GL_FRAMEBUFFER) == GL40.GL_FRAMEBUFFER_COMPLETE;
public boolean isComplete(OpenGLState openGLState){
if(this.framebufferPointer == DEFAULT_FRAMEBUFFER_POINTER){
throw new Error("Pointer is the default framebuffer!");
}
return glCheckNamedFramebufferStatus(this.framebufferPointer,GL40.GL_FRAMEBUFFER) == GL40.GL_FRAMEBUFFER_COMPLETE;
}
/**
* Checks if the framebuffer has an error
* @return true if error, false otherwise
*/
public boolean isError(){
return glCheckNamedFramebufferStatus(framebufferPointer,GL40.GL_FRAMEBUFFER) == 0;
}
/**
* Checks the status of the framebuffer
* @param openGLState The opengl state
*/
public void checkStatus(){
if(this.isError()){
LoggerInterface.loggerRenderer.WARNING("Framebuffer [glError] - " + RenderingEngine.getErrorInEnglish(Globals.renderingEngine.getError()));
LoggerInterface.loggerRenderer.WARNING("Framebuffer [status] - " + this.getStatus());
} else if(!this.isComplete()){
LoggerInterface.loggerRenderer.WARNING("Framebuffer [glError] - " + RenderingEngine.getErrorInEnglish(Globals.renderingEngine.getError()));
LoggerInterface.loggerRenderer.WARNING("Framebuffer [status] - " + this.getStatus());
LoggerInterface.loggerRenderer.ERROR("Failed to build framebuffer", new IllegalStateException("Framebuffer failed to build."));
public void shouldBeComplete(OpenGLState openGLState){
if(!this.isComplete(openGLState)){
int colorAttach0 = GL45.glGetFramebufferAttachmentParameteri(GL_FRAMEBUFFER, GL45.GL_COLOR_ATTACHMENT0, GL45.GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE);
String attach0Type = "";
switch(colorAttach0){
case GL_NONE: {
attach0Type = "GL_NONE";
} break;
case GL_TEXTURE: {
attach0Type = " GL_TEXTURE";
} break;
}
this.texture.bind(openGLState);
int[] storage = new int[1];
int width = 0;
int height = 0;
GL45.glGetTexLevelParameteriv(GL45.GL_TEXTURE_2D, 0, GL45.GL_TEXTURE_WIDTH, storage);
width = storage[0];
GL45.glGetTexLevelParameteriv(GL45.GL_TEXTURE_2D, 0, GL45.GL_TEXTURE_HEIGHT, storage);
height = storage[0];
String message = "Framebuffer failed to build.\n" +
"Framebuffer [status] - " + this.getStatus() + "\n" +
"Texture: " + this.texture + "\n" +
"attach0Type: " + attach0Type + "\n" +
"attach0 Dims: " + width + "," + height + "\n" +
"Depth: " + this.depthTexture + "\n"
;
LoggerInterface.loggerEngine.ERROR(new Exception(message));
}
}
@ -136,7 +157,7 @@ public class Framebuffer {
* Blocks the thread until the framebuffer has compiled
*/
public void blockUntilCompiled(){
while(glCheckNamedFramebufferStatus(framebufferPointer,GL40.GL_FRAMEBUFFER) != GL40.GL_FRAMEBUFFER_UNDEFINED){
while(glCheckNamedFramebufferStatus(this.framebufferPointer,GL40.GL_FRAMEBUFFER) != GL40.GL_FRAMEBUFFER_UNDEFINED){
try {
TimeUnit.MILLISECONDS.sleep(1);
} catch (InterruptedException ex) {
@ -150,7 +171,7 @@ public class Framebuffer {
* @return The status
*/
public String getStatus(){
switch(glCheckNamedFramebufferStatus(framebufferPointer,GL40.GL_FRAMEBUFFER)){
switch(glCheckNamedFramebufferStatus(this.framebufferPointer,GL40.GL_FRAMEBUFFER)){
case GL40.GL_FRAMEBUFFER_UNDEFINED: {
return "The specified framebuffer is the default read or draw framebuffer, but the default framebuffer does not exist.";
}
@ -220,6 +241,15 @@ public class Framebuffer {
openGLState.glBindFramebuffer(GL40.GL_FRAMEBUFFER, this.framebufferPointer);
GL40.glFramebufferTexture2D(GL40.GL_FRAMEBUFFER, GL40.GL_COLOR_ATTACHMENT0 + attachmentNum, GL40.GL_TEXTURE_2D, texture.getTexturePointer(), 0);
Globals.renderingEngine.checkError();
// check the attachment slot
int colorAttach0 = GL45.glGetFramebufferAttachmentParameteri(GL40.GL_FRAMEBUFFER, GL45.GL_COLOR_ATTACHMENT0 + attachmentNum, GL45.GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE);
switch(colorAttach0){
case GL_NONE: {
throw new Error("Failed to attach!");
}
case GL_TEXTURE: {
} break;
}
Globals.renderingEngine.defaultFramebuffer.bind(openGLState);
}

View File

@ -9,9 +9,11 @@ import java.nio.IntBuffer;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL40;
import org.lwjgl.opengl.GL45;
import static org.lwjgl.opengl.GL11.GL_DEPTH_COMPONENT;
import static org.lwjgl.opengl.GL11.GL_FLOAT;
import static org.lwjgl.opengl.GL11.GL_FRONT;
import static org.lwjgl.opengl.GL11.GL_LINEAR;
import static org.lwjgl.opengl.GL11.GL_NEAREST;
import static org.lwjgl.opengl.GL11.GL_NONE;
@ -22,6 +24,7 @@ import static org.lwjgl.opengl.GL11.GL_SHORT;
import static org.lwjgl.opengl.GL11.GL_TEXTURE_WRAP_S;
import static org.lwjgl.opengl.GL11.GL_TEXTURE_WRAP_T;
import static org.lwjgl.opengl.GL11.GL_UNSIGNED_BYTE;
import static org.lwjgl.opengl.GL11.GL_UNSIGNED_INT;
import static org.lwjgl.opengl.GL12.GL_CLAMP_TO_EDGE;
import static org.lwjgl.opengl.GL13.GL_CLAMP_TO_BORDER;
import static org.lwjgl.opengl.GL30.GL_COLOR_ATTACHMENT0;
@ -35,6 +38,8 @@ import static org.lwjgl.opengl.GL30.glBindRenderbuffer;
import static org.lwjgl.opengl.GL30.glFramebufferRenderbuffer;
import static org.lwjgl.opengl.GL30.glGenRenderbuffers;
import static org.lwjgl.opengl.GL30.glRenderbufferStorage;
import static org.lwjgl.opengl.GL40.GL_DEPTH_COMPONENT;
import static org.lwjgl.opengl.GL40.GL_FLOAT;
import static org.lwjgl.opengl.GL45.glNamedFramebufferDrawBuffer;
import static org.lwjgl.opengl.GL45.glNamedFramebufferDrawBuffers;
import static org.lwjgl.opengl.GL45.glNamedFramebufferReadBuffer;
@ -46,6 +51,7 @@ public class FramebufferUtils {
public static Texture generateScreenTextureColor(OpenGLState openGLState, int width, int height){
Texture texture = new Texture();
texture.bind(openGLState);
texture.glTexImage2D(openGLState, width, height, GL_RGB, GL_UNSIGNED_BYTE);
texture.setMinFilter(openGLState, GL_LINEAR);
texture.setMagFilter(openGLState, GL_LINEAR);
@ -64,7 +70,8 @@ public class FramebufferUtils {
public static Texture generateScreenTextureColorAlpha(OpenGLState openGLState, int width, int height){
Texture texture = new Texture();
texture.glTexImage2D(openGLState, width, height, GL_RGBA, GL_UNSIGNED_BYTE);
texture.bind(openGLState);
texture.glTexImage2D(openGLState, width, height, GL_RGBA, GL45.GL_UNSIGNED_INT_8_8_8_8);
texture.setMinFilter(openGLState, GL_LINEAR);
texture.setMagFilter(openGLState, GL_LINEAR);
//these make sure the texture actually clamps to the borders of the quad
@ -74,7 +81,7 @@ public class FramebufferUtils {
//guarantees that the texture object has actually been created (calling gen buffers does not guarantee object creation)
texture.bind(openGLState);
openGLState.glBindTexture(GL40.GL_TEXTURE_2D, Texture.DEFAULT_TEXTURE);
openGLState.glBindTextureUnitForce(0, Texture.DEFAULT_TEXTURE, GL40.GL_TEXTURE_2D);
texture.checkStatus(openGLState);
return texture;
@ -82,6 +89,7 @@ public class FramebufferUtils {
public static Texture generateScreenTextureDepth(OpenGLState openGLState, int width, int height){
Texture texture = new Texture();
texture.bind(openGLState);
texture.glTexImage2D(openGLState, width, height, GL_DEPTH_COMPONENT, GL_FLOAT);
texture.setMinFilter(openGLState, GL_LINEAR);
@ -93,7 +101,7 @@ public class FramebufferUtils {
//guarantees that the texture object has actually been created (calling gen buffers does not guarantee object creation)
texture.bind(openGLState);
openGLState.glBindTexture(GL40.GL_TEXTURE_2D, Texture.DEFAULT_TEXTURE);
openGLState.glBindTextureUnitForce(0, Texture.DEFAULT_TEXTURE, GL40.GL_TEXTURE_2D);
texture.checkStatus(openGLState);
return texture;
@ -106,8 +114,10 @@ public class FramebufferUtils {
buffer.setMipMapLevel(0);
buffer.attachTexture(openGLState,colorTexture);
buffer.setDepthAttachment(openGLState,depthTexture);
buffer.bind(openGLState);
Globals.renderingEngine.defaultFramebuffer.bind(openGLState);
//check make sure compiled
buffer.checkStatus();
buffer.shouldBeComplete(openGLState);
Globals.renderingEngine.defaultFramebuffer.bind(openGLState);
return buffer;
}
@ -118,7 +128,7 @@ public class FramebufferUtils {
buffer.setMipMapLevel(0);
buffer.attachTexture(openGLState,colorTexture);
//check make sure compiled
buffer.checkStatus();
buffer.shouldBeComplete(openGLState);
return buffer;
}
@ -147,7 +157,7 @@ public class FramebufferUtils {
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, renderBuffer);
Globals.renderingEngine.checkError();
//check make sure compiled
buffer.checkStatus();
buffer.shouldBeComplete(openGLState);
Globals.renderingEngine.defaultFramebuffer.bind(openGLState);
return buffer;
}
@ -178,7 +188,7 @@ public class FramebufferUtils {
GL40.glFramebufferRenderbuffer(GL40.GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, renderBuffer);
Globals.renderingEngine.checkError();
//check make sure compiled
buffer.checkStatus();
buffer.shouldBeComplete(openGLState);
//re-bind default buffer
Globals.renderingEngine.defaultFramebuffer.bind(openGLState);
return buffer;
@ -223,7 +233,7 @@ public class FramebufferUtils {
//check make sure compiled
buffer.checkStatus();
buffer.shouldBeComplete(openGLState);
Globals.renderingEngine.defaultFramebuffer.bind(openGLState);
return buffer;
}
@ -257,7 +267,7 @@ public class FramebufferUtils {
//check make sure compiled
buffer.checkStatus();
buffer.shouldBeComplete(openGLState);
Globals.renderingEngine.defaultFramebuffer.bind(openGLState);
return buffer;
}
@ -301,7 +311,7 @@ public class FramebufferUtils {
Globals.renderingEngine.checkError();
//check make sure compiled
buffer.checkStatus();
buffer.shouldBeComplete(openGLState);
Globals.renderingEngine.defaultFramebuffer.bind(openGLState);
return buffer;
}

View File

@ -390,13 +390,27 @@ public class Texture {
this.height = height;
this.pixelFormat = format;
this.datatype = datatype;
int internalFormat = format;
if(internalFormat == GL45.GL_DEPTH_COMPONENT){
internalFormat = GL45.GL_DEPTH_COMPONENT24;
}
//static values going into call
int level = 0;
int border = 0; //this must be 0 according to docs
openGLState.glBindTexture(GL_TEXTURE_2D,texturePointer);
Globals.renderingEngine.checkError();
GL40.glTexImage2D(GL_TEXTURE_2D, level, format, width, height, border, format, datatype, MemoryUtil.NULL);
GL40.glTexImage2D(GL_TEXTURE_2D, level, internalFormat, width, height, border, format, datatype, MemoryUtil.NULL);
Globals.renderingEngine.checkError();
int[] storage = new int[1];
int discoveredWidth = 0;
int discoveredHeight = 0;
GL45.glGetTexLevelParameteriv(GL45.GL_TEXTURE_2D, 0, GL45.GL_TEXTURE_WIDTH, storage);
discoveredWidth = storage[0];
GL45.glGetTexLevelParameteriv(GL45.GL_TEXTURE_2D, 0, GL45.GL_TEXTURE_HEIGHT, storage);
discoveredHeight = storage[0];
if(width != discoveredWidth || height != discoveredHeight){
throw new Error("Found dims aren't the same! " + width + "," + height + " vs " + discoveredWidth + "," + discoveredHeight);
}
}
/**
@ -528,6 +542,13 @@ public class Texture {
}
}
/**
* Frees the texture
*/
public void free(){
GL40.glDeleteTextures(this.texturePointer);
}
@Override
public String toString(){
String rVal = "" +

View File

@ -10,8 +10,6 @@ import electrosphere.engine.loadingthreads.LoadingThread;
import electrosphere.engine.loadingthreads.LoadingThread.LoadingThreadType;
import electrosphere.engine.profiler.Profiler;
import electrosphere.net.NetUtils;
import electrosphere.renderer.ui.elementtypes.DrawableElement;
import electrosphere.renderer.ui.elementtypes.Element;
public class EngineInit {