diff --git a/buildNumber.properties b/buildNumber.properties index 2c47b05f..3e3325f3 100644 --- a/buildNumber.properties +++ b/buildNumber.properties @@ -1,3 +1,3 @@ #maven.buildNumber.plugin properties file -#Tue Sep 10 19:22:32 EDT 2024 -buildNumber=326 +#Tue Sep 10 20:21:08 EDT 2024 +buildNumber=328 diff --git a/src/main/java/electrosphere/renderer/texture/Texture.java b/src/main/java/electrosphere/renderer/texture/Texture.java index 92f943a3..899bf669 100644 --- a/src/main/java/electrosphere/renderer/texture/Texture.java +++ b/src/main/java/electrosphere/renderer/texture/Texture.java @@ -260,7 +260,7 @@ public class Texture { //buffer the texture information this.pixelFormat = GL_RED; this.datatype = GL_FLOAT; - this.glTexImage2D(openGlState, width, height, GL_RED, GL_FLOAT); + this.glTexImage2D(openGlState, GL_R32F, width, height, GL_RED, GL_FLOAT, buffer); //check build status String errorMessage = RenderingEngine.getErrorInEnglish(Globals.renderingEngine.getError()); if(errorMessage != null){ @@ -445,9 +445,33 @@ public class Texture { //static values going into call int level = 0; int border = 0; //this must be 0 according to docs + int internalFormat = format; openGLState.glBindTexture(GL_TEXTURE_2D,texturePointer); Globals.renderingEngine.checkError(); - GL40.glTexImage2D(GL_TEXTURE_2D, level, format, width, height, border, format, datatype, data); + GL40.glTexImage2D(GL_TEXTURE_2D, level, internalFormat, width, height, border, format, datatype, data); + Globals.renderingEngine.checkError(); + } + + /** + * Specifies a 2d image + * @param width The width of the image + * @param height The height of the image + * @param format The format of the pixels (ie GL_RGB, GL_RGBA, etc) + * @param datatype The data type of a single component of a pixel (ie GL_BYTE, GL_UNSIGNED_INT, etc) + * @param data The data to populate the image with + */ + public void glTexImage2D(OpenGLState openGLState, int internalFormat, int width, int height, int format, int datatype, ByteBuffer data){ + //store provided values + this.width = width; + this.height = height; + this.pixelFormat = format; + this.datatype = datatype; + //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, internalFormat, width, height, border, format, datatype, data); Globals.renderingEngine.checkError(); }