diff --git a/java/libraries/opengl2/src/processing/opengl2/PTexture.java b/java/libraries/opengl2/src/processing/opengl2/PTexture.java index 43fc5ba9e..957ad6651 100644 --- a/java/libraries/opengl2/src/processing/opengl2/PTexture.java +++ b/java/libraries/opengl2/src/processing/opengl2/PTexture.java @@ -279,7 +279,7 @@ public class PTexture implements PConstants { gl.glBindTexture(glTarget, 0); gl.glDisable(glTarget); } - + //////////////////////////////////////////////////////////// @@ -412,14 +412,27 @@ public class PTexture implements PConstants { public void setFlippedY(boolean v) { flippedY = v; } - + + //////////////////////////////////////////////////////////// + + // Bind/unbind + + public void bind() { + gl.glEnable(glTarget); + gl.glBindTexture(glTarget, glID); + } + + public void unbind() { + gl.glEnable(glTarget); + gl.glBindTexture(glTarget, 0); + } //////////////////////////////////////////////////////////// // Utilities // bit shifting this might be more efficient - private int nextPowerOfTwo(int val) { + protected int nextPowerOfTwo(int val) { int ret = 1; while (ret < val) { ret <<= 1; @@ -768,16 +781,6 @@ public class PTexture implements PConstants { gl.glTexSubImage2D(glTarget, 0, x, y, w, h, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, IntBuffer.wrap(pix)); } - protected void bind() { - gl.glEnable(glTarget); - gl.glBindTexture(glTarget, glID); - } - - protected void unbind() { - gl.glEnable(glTarget); - gl.glBindTexture(glTarget, 0); - } - protected void copyObject(PTexture src) { // The OpenGL texture of this object is replaced with the one from the source object, // so we delete the former to avoid resource wasting.