bind/unbind methods in PTexture are public

This commit is contained in:
codeanticode
2011-05-23 09:18:23 +00:00
parent b817aa9306
commit b074923e44
@@ -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.