From 58e5207584e0375329984f8554bc9c557052935e Mon Sep 17 00:00:00 2001 From: codeanticode Date: Fri, 10 Aug 2012 21:03:51 +0000 Subject: [PATCH] removed gl prefix to the opengl functions in PGL, renamed beginGL/endGL to beginPGL/endPGL --- core/src/processing/core/PApplet.java | 10 +- core/src/processing/core/PGraphics.java | 4 +- core/src/processing/opengl/FrameBuffer.java | 76 +- core/src/processing/opengl/PGL.java | 692 +++++++++--------- .../processing/opengl/PGraphicsOpenGL.java | 594 +++++++-------- core/src/processing/opengl/PShader.java | 136 ++-- core/src/processing/opengl/PShapeOpenGL.java | 216 +++--- core/src/processing/opengl/Texture.java | 110 +-- 8 files changed, 918 insertions(+), 920 deletions(-) diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java index 8864e4d9d..66d3224e2 100644 --- a/core/src/processing/core/PApplet.java +++ b/core/src/processing/core/PApplet.java @@ -9864,14 +9864,14 @@ public class PApplet extends Applet // public functions for processing.core - public PGL beginGL() { - return g.beginGL(); + public PGL beginPGL() { + return g.beginPGL(); } - public void endGL() { - if (recorder != null) recorder.endGL(); - g.endGL(); + public void endPGL() { + if (recorder != null) recorder.endPGL(); + g.endPGL(); } diff --git a/core/src/processing/core/PGraphics.java b/core/src/processing/core/PGraphics.java index 1801575c4..f078c99b5 100644 --- a/core/src/processing/core/PGraphics.java +++ b/core/src/processing/core/PGraphics.java @@ -721,13 +721,13 @@ public class PGraphics extends PImage implements PConstants { } - public PGL beginGL() { + public PGL beginPGL() { showMethodWarning("beginGL"); return null; } - public void endGL() { + public void endPGL() { showMethodWarning("endGL"); } diff --git a/core/src/processing/opengl/FrameBuffer.java b/core/src/processing/opengl/FrameBuffer.java index c28cd3489..e63c638df 100644 --- a/core/src/processing/opengl/FrameBuffer.java +++ b/core/src/processing/opengl/FrameBuffer.java @@ -166,23 +166,23 @@ public class FrameBuffer implements PConstants { public void clear() { pg.pushFramebuffer(); pg.setFramebuffer(this); - pgl.glClearDepth(1); - pgl.glClearStencil(0); - pgl.glClearColor(0, 0, 0, 0); - pgl.glClear(PGL.GL_DEPTH_BUFFER_BIT | PGL.GL_STENCIL_BUFFER_BIT | PGL.GL_COLOR_BUFFER_BIT); + pgl.clearDepth(1); + pgl.clearStencil(0); + pgl.clearColor(0, 0, 0, 0); + pgl.clear(PGL.DEPTH_BUFFER_BIT | PGL.STENCIL_BUFFER_BIT | PGL.COLOR_BUFFER_BIT); pg.popFramebuffer(); } public void copy(FrameBuffer dest) { - pgl.glBindFramebuffer(PGL.GL_READ_FRAMEBUFFER, this.glFbo); - pgl.glBindFramebuffer(PGL.GL_DRAW_FRAMEBUFFER, dest.glFbo); - pgl.glBlitFramebuffer(0, 0, this.width, this.height, + pgl.bindFramebuffer(PGL.READ_FRAMEBUFFER, this.glFbo); + pgl.bindFramebuffer(PGL.DRAW_FRAMEBUFFER, dest.glFbo); + pgl.blitFramebuffer(0, 0, this.width, this.height, 0, 0, dest.width, dest.height, - PGL.GL_COLOR_BUFFER_BIT, PGL.GL_NEAREST); + PGL.COLOR_BUFFER_BIT, PGL.NEAREST); } public void bind() { - pgl.glBindFramebuffer(PGL.GL_FRAMEBUFFER, glFbo); + pgl.bindFramebuffer(PGL.FRAMEBUFFER, glFbo); } public void disableDepthTest() { @@ -193,9 +193,9 @@ public class FrameBuffer implements PConstants { if (noDepth) { // No need to clear depth buffer because depth testing was disabled. if (pg.hintEnabled(ENABLE_DEPTH_TEST)) { - pgl.glEnable(PGL.GL_DEPTH_TEST); + pgl.enable(PGL.DEPTH_TEST); } else { - pgl.glDisable(PGL.GL_DEPTH_TEST); + pgl.disable(PGL.DEPTH_TEST); } } } @@ -203,7 +203,7 @@ public class FrameBuffer implements PConstants { public void readPixels() { if (pixelBuffer == null) createPixelBuffer(); pixelBuffer.rewind(); - pgl.glReadPixels(0, 0, width, height, PGL.GL_RGBA, PGL.GL_UNSIGNED_BYTE, pixelBuffer); + pgl.readPixels(0, 0, width, height, PGL.RGBA, PGL.UNSIGNED_BYTE, pixelBuffer); } public void getPixels(int[] pixels) { @@ -256,11 +256,11 @@ public class FrameBuffer implements PConstants { // Making sure nothing is attached. for (int i = 0; i < numColorBuffers; i++) { - pgl.glFramebufferTexture2D(PGL.GL_FRAMEBUFFER, PGL.GL_COLOR_ATTACHMENT0 + i, PGL.GL_TEXTURE_2D, 0, 0); + pgl.framebufferTexture2D(PGL.FRAMEBUFFER, PGL.COLOR_ATTACHMENT0 + i, PGL.TEXTURE_2D, 0, 0); } for (int i = 0; i < numColorBuffers; i++) { - pgl.glFramebufferTexture2D(PGL.GL_FRAMEBUFFER, PGL.GL_COLOR_ATTACHMENT0 + i, colorBufferTex[i].glTarget, colorBufferTex[i].glName, 0); + pgl.framebufferTexture2D(PGL.FRAMEBUFFER, PGL.COLOR_ATTACHMENT0 + i, colorBufferTex[i].glTarget, colorBufferTex[i].glName, 0); } pgl.validateFramebuffer(); @@ -357,9 +357,9 @@ public class FrameBuffer implements PConstants { pg.setFramebuffer(this); glMultisample = pg.createRenderBufferObject(context.code()); - pgl.glBindRenderbuffer(PGL.GL_RENDERBUFFER, glMultisample); - pgl.glRenderbufferStorageMultisample(PGL.GL_RENDERBUFFER, nsamples, PGL.GL_RGBA8, width, height); - pgl.glFramebufferRenderbuffer(PGL.GL_FRAMEBUFFER, PGL.GL_COLOR_ATTACHMENT0, PGL.GL_RENDERBUFFER, glMultisample); + pgl.bindRenderbuffer(PGL.RENDERBUFFER, glMultisample); + pgl.renderbufferStorageMultisample(PGL.RENDERBUFFER, nsamples, PGL.RGBA8, width, height); + pgl.framebufferRenderbuffer(PGL.FRAMEBUFFER, PGL.COLOR_ATTACHMENT0, PGL.RENDERBUFFER, glMultisample); pg.popFramebuffer(); } @@ -376,16 +376,16 @@ public class FrameBuffer implements PConstants { pg.setFramebuffer(this); glDepthStencil = pg.createRenderBufferObject(context.code()); - pgl.glBindRenderbuffer(PGL.GL_RENDERBUFFER, glDepthStencil); + pgl.bindRenderbuffer(PGL.RENDERBUFFER, glDepthStencil); if (multisample) { - pgl.glRenderbufferStorageMultisample(PGL.GL_RENDERBUFFER, nsamples, PGL.GL_DEPTH24_STENCIL8, width, height); + pgl.renderbufferStorageMultisample(PGL.RENDERBUFFER, nsamples, PGL.DEPTH24_STENCIL8, width, height); } else { - pgl.glRenderbufferStorage(PGL.GL_RENDERBUFFER, PGL.GL_DEPTH24_STENCIL8, width, height); + pgl.renderbufferStorage(PGL.RENDERBUFFER, PGL.DEPTH24_STENCIL8, width, height); } - pgl.glFramebufferRenderbuffer(PGL.GL_FRAMEBUFFER, PGL.GL_DEPTH_ATTACHMENT, PGL.GL_RENDERBUFFER, glDepthStencil); - pgl.glFramebufferRenderbuffer(PGL.GL_FRAMEBUFFER, PGL.GL_STENCIL_ATTACHMENT, PGL.GL_RENDERBUFFER, glDepthStencil); + pgl.framebufferRenderbuffer(PGL.FRAMEBUFFER, PGL.DEPTH_ATTACHMENT, PGL.RENDERBUFFER, glDepthStencil); + pgl.framebufferRenderbuffer(PGL.FRAMEBUFFER, PGL.STENCIL_ATTACHMENT, PGL.RENDERBUFFER, glDepthStencil); pg.popFramebuffer(); } @@ -402,24 +402,24 @@ public class FrameBuffer implements PConstants { pg.setFramebuffer(this); glDepth = pg.createRenderBufferObject(context.code()); - pgl.glBindRenderbuffer(PGL.GL_RENDERBUFFER, glDepth); + pgl.bindRenderbuffer(PGL.RENDERBUFFER, glDepth); - int glConst = PGL.GL_DEPTH_COMPONENT16; + int glConst = PGL.DEPTH_COMPONENT16; if (depthBits == 16) { - glConst = PGL.GL_DEPTH_COMPONENT16; + glConst = PGL.DEPTH_COMPONENT16; } else if (depthBits == 24) { - glConst = PGL.GL_DEPTH_COMPONENT24; + glConst = PGL.DEPTH_COMPONENT24; } else if (depthBits == 32) { - glConst = PGL.GL_DEPTH_COMPONENT32; + glConst = PGL.DEPTH_COMPONENT32; } if (multisample) { - pgl.glRenderbufferStorageMultisample(PGL.GL_RENDERBUFFER, nsamples, glConst, width, height); + pgl.renderbufferStorageMultisample(PGL.RENDERBUFFER, nsamples, glConst, width, height); } else { - pgl.glRenderbufferStorage(PGL.GL_RENDERBUFFER, glConst, width, height); + pgl.renderbufferStorage(PGL.RENDERBUFFER, glConst, width, height); } - pgl.glFramebufferRenderbuffer(PGL.GL_FRAMEBUFFER, PGL.GL_DEPTH_ATTACHMENT, PGL.GL_RENDERBUFFER, glDepth); + pgl.framebufferRenderbuffer(PGL.FRAMEBUFFER, PGL.DEPTH_ATTACHMENT, PGL.RENDERBUFFER, glDepth); pg.popFramebuffer(); } @@ -436,23 +436,23 @@ public class FrameBuffer implements PConstants { pg.setFramebuffer(this); glStencil = pg.createRenderBufferObject(context.code()); - pgl.glBindRenderbuffer(PGL.GL_RENDERBUFFER, glStencil); + pgl.bindRenderbuffer(PGL.RENDERBUFFER, glStencil); - int glConst = PGL.GL_STENCIL_INDEX1; + int glConst = PGL.STENCIL_INDEX1; if (stencilBits == 1) { - glConst = PGL.GL_STENCIL_INDEX1; + glConst = PGL.STENCIL_INDEX1; } else if (stencilBits == 4) { - glConst = PGL.GL_STENCIL_INDEX4; + glConst = PGL.STENCIL_INDEX4; } else if (stencilBits == 8) { - glConst = PGL.GL_STENCIL_INDEX8; + glConst = PGL.STENCIL_INDEX8; } if (multisample) { - pgl.glRenderbufferStorageMultisample(PGL.GL_RENDERBUFFER, nsamples, glConst, width, height); + pgl.renderbufferStorageMultisample(PGL.RENDERBUFFER, nsamples, glConst, width, height); } else { - pgl.glRenderbufferStorage(PGL.GL_RENDERBUFFER, glConst, width, height); + pgl.renderbufferStorage(PGL.RENDERBUFFER, glConst, width, height); } - pgl.glFramebufferRenderbuffer(PGL.GL_FRAMEBUFFER, PGL.GL_STENCIL_ATTACHMENT, PGL.GL_RENDERBUFFER, glStencil); + pgl.framebufferRenderbuffer(PGL.FRAMEBUFFER, PGL.STENCIL_ATTACHMENT, PGL.RENDERBUFFER, glStencil); pg.popFramebuffer(); } diff --git a/core/src/processing/opengl/PGL.java b/core/src/processing/opengl/PGL.java index 1f295fbba..12da1b767 100644 --- a/core/src/processing/opengl/PGL.java +++ b/core/src/processing/opengl/PGL.java @@ -154,155 +154,155 @@ public class PGL { // OpenGL constants - public static final int GL_FALSE = GL.GL_FALSE; - public static final int GL_TRUE = GL.GL_TRUE; + public static final int FALSE = GL.GL_FALSE; + public static final int TRUE = GL.GL_TRUE; - public static final int GL_LESS = GL.GL_LESS; - public static final int GL_LEQUAL = GL.GL_LEQUAL; + public static final int LESS = GL.GL_LESS; + public static final int LEQUAL = GL.GL_LEQUAL; - public static final int GL_CCW = GL.GL_CCW; - public static final int GL_CW = GL.GL_CW; + public static final int CCW = GL.GL_CCW; + public static final int CW = GL.GL_CW; - public static final int GL_CULL_FACE = GL.GL_CULL_FACE; - public static final int GL_FRONT = GL.GL_FRONT; - public static final int GL_BACK = GL.GL_BACK; - public static final int GL_FRONT_AND_BACK = GL.GL_FRONT_AND_BACK; + public static final int CULL_FACE = GL.GL_CULL_FACE; + public static final int FRONT = GL.GL_FRONT; + public static final int BACK = GL.GL_BACK; + public static final int FRONT_AND_BACK = GL.GL_FRONT_AND_BACK; - public static final int GL_VIEWPORT = GL.GL_VIEWPORT; + public static final int VIEWPORT = GL.GL_VIEWPORT; - public static final int GL_SCISSOR_TEST = GL.GL_SCISSOR_TEST; - public static final int GL_DEPTH_TEST = GL.GL_DEPTH_TEST; - public static final int GL_DEPTH_WRITEMASK = GL.GL_DEPTH_WRITEMASK; + public static final int SCISSOR_TEST = GL.GL_SCISSOR_TEST; + public static final int DEPTH_TEST = GL.GL_DEPTH_TEST; + public static final int DEPTH_WRITEMASK = GL.GL_DEPTH_WRITEMASK; - public static final int GL_COLOR_BUFFER_BIT = GL.GL_COLOR_BUFFER_BIT; - public static final int GL_DEPTH_BUFFER_BIT = GL.GL_DEPTH_BUFFER_BIT; - public static final int GL_STENCIL_BUFFER_BIT = GL.GL_STENCIL_BUFFER_BIT; + public static final int COLOR_BUFFER_BIT = GL.GL_COLOR_BUFFER_BIT; + public static final int DEPTH_BUFFER_BIT = GL.GL_DEPTH_BUFFER_BIT; + public static final int STENCIL_BUFFER_BIT = GL.GL_STENCIL_BUFFER_BIT; - public static final int GL_FUNC_ADD = GL.GL_FUNC_ADD; - public static final int GL_FUNC_MIN = GL2.GL_MIN; - public static final int GL_FUNC_MAX = GL2.GL_MAX; - public static final int GL_FUNC_REVERSE_SUBTRACT = GL.GL_FUNC_REVERSE_SUBTRACT; + public static final int FUNC_ADD = GL.GL_FUNC_ADD; + public static final int FUNC_MIN = GL2.GL_MIN; + public static final int FUNC_MAX = GL2.GL_MAX; + public static final int FUNC_REVERSE_SUBTRACT = GL.GL_FUNC_REVERSE_SUBTRACT; - public static final int GL_TEXTURE_2D = GL.GL_TEXTURE_2D; - public static final int GL_TEXTURE_RECTANGLE = GL2.GL_TEXTURE_RECTANGLE; + public static final int TEXTURE_2D = GL.GL_TEXTURE_2D; + public static final int TEXTURE_RECTANGLE = GL2.GL_TEXTURE_RECTANGLE; - public static final int GL_TEXTURE_BINDING_2D = GL.GL_TEXTURE_BINDING_2D; - public static final int GL_TEXTURE_BINDING_RECTANGLE = GL2.GL_TEXTURE_BINDING_RECTANGLE; + public static final int TEXTURE_BINDING_2D = GL.GL_TEXTURE_BINDING_2D; + public static final int TEXTURE_BINDING_RECTANGLE = GL2.GL_TEXTURE_BINDING_RECTANGLE; - public static final int GL_RGB = GL.GL_RGB; - public static final int GL_RGBA = GL.GL_RGBA; - public static final int GL_ALPHA = GL.GL_ALPHA; - public static final int GL_UNSIGNED_INT = GL.GL_UNSIGNED_INT; - public static final int GL_UNSIGNED_BYTE = GL.GL_UNSIGNED_BYTE; - public static final int GL_UNSIGNED_SHORT = GL.GL_UNSIGNED_SHORT; - public static final int GL_FLOAT = GL.GL_FLOAT; + public static final int RGB = GL.GL_RGB; + public static final int RGBA = GL.GL_RGBA; + public static final int ALPHA = GL.GL_ALPHA; + public static final int UNSIGNED_INT = GL.GL_UNSIGNED_INT; + public static final int UNSIGNED_BYTE = GL.GL_UNSIGNED_BYTE; + public static final int UNSIGNED_SHORT = GL.GL_UNSIGNED_SHORT; + public static final int FLOAT = GL.GL_FLOAT; - public static final int GL_NEAREST = GL.GL_NEAREST; - public static final int GL_LINEAR = GL.GL_LINEAR; - public static final int GL_LINEAR_MIPMAP_NEAREST = GL.GL_LINEAR_MIPMAP_NEAREST; - public static final int GL_LINEAR_MIPMAP_LINEAR = GL.GL_LINEAR_MIPMAP_LINEAR; + public static final int NEAREST = GL.GL_NEAREST; + public static final int LINEAR = GL.GL_LINEAR; + public static final int LINEAR_MIPMAP_NEAREST = GL.GL_LINEAR_MIPMAP_NEAREST; + public static final int LINEAR_MIPMAP_LINEAR = GL.GL_LINEAR_MIPMAP_LINEAR; - public static final int GL_CLAMP_TO_EDGE = GL.GL_CLAMP_TO_EDGE; - public static final int GL_REPEAT = GL.GL_REPEAT; + public static final int CLAMP_TO_EDGE = GL.GL_CLAMP_TO_EDGE; + public static final int REPEAT = GL.GL_REPEAT; - public static final int GL_RGBA8 = GL.GL_RGBA8; - public static final int GL_DEPTH24_STENCIL8 = GL.GL_DEPTH24_STENCIL8; + public static final int RGBA8 = GL.GL_RGBA8; + public static final int DEPTH24_STENCIL8 = GL.GL_DEPTH24_STENCIL8; - public static final int GL_DEPTH_COMPONENT = GL2.GL_DEPTH_COMPONENT; - public static final int GL_DEPTH_COMPONENT16 = GL.GL_DEPTH_COMPONENT16; - public static final int GL_DEPTH_COMPONENT24 = GL.GL_DEPTH_COMPONENT24; - public static final int GL_DEPTH_COMPONENT32 = GL.GL_DEPTH_COMPONENT32; + public static final int DEPTH_COMPONENT = GL2.GL_DEPTH_COMPONENT; + public static final int DEPTH_COMPONENT16 = GL.GL_DEPTH_COMPONENT16; + public static final int DEPTH_COMPONENT24 = GL.GL_DEPTH_COMPONENT24; + public static final int DEPTH_COMPONENT32 = GL.GL_DEPTH_COMPONENT32; - public static final int GL_STENCIL_INDEX = GL2.GL_STENCIL_INDEX; - public static final int GL_STENCIL_INDEX1 = GL.GL_STENCIL_INDEX1; - public static final int GL_STENCIL_INDEX4 = GL.GL_STENCIL_INDEX4; - public static final int GL_STENCIL_INDEX8 = GL.GL_STENCIL_INDEX8; + public static final int STENCIL_INDEX = GL2.GL_STENCIL_INDEX; + public static final int STENCIL_INDEX1 = GL.GL_STENCIL_INDEX1; + public static final int STENCIL_INDEX4 = GL.GL_STENCIL_INDEX4; + public static final int STENCIL_INDEX8 = GL.GL_STENCIL_INDEX8; - public static final int GL_ARRAY_BUFFER = GL.GL_ARRAY_BUFFER; - public static final int GL_ELEMENT_ARRAY_BUFFER = GL.GL_ELEMENT_ARRAY_BUFFER; + public static final int ARRAY_BUFFER = GL.GL_ARRAY_BUFFER; + public static final int ELEMENT_ARRAY_BUFFER = GL.GL_ELEMENT_ARRAY_BUFFER; - public static final int GL_SAMPLES = GL.GL_SAMPLES; + public static final int SAMPLES = GL.GL_SAMPLES; - public static final int GL_FRAMEBUFFER_COMPLETE = GL.GL_FRAMEBUFFER_COMPLETE; - public static final int GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT = GL.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; - public static final int GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = GL.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT; - public static final int GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS = GL.GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS; - public static final int GL_FRAMEBUFFER_INCOMPLETE_FORMATS = GL.GL_FRAMEBUFFER_INCOMPLETE_FORMATS; - public static final int GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER = GL2.GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER; - public static final int GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER = GL2.GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER; - public static final int GL_FRAMEBUFFER_UNSUPPORTED = GL.GL_FRAMEBUFFER_UNSUPPORTED; + public static final int FRAMEBUFFER_COMPLETE = GL.GL_FRAMEBUFFER_COMPLETE; + public static final int FRAMEBUFFER_INCOMPLETE_ATTACHMENT = GL.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; + public static final int FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = GL.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT; + public static final int FRAMEBUFFER_INCOMPLETE_DIMENSIONS = GL.GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS; + public static final int FRAMEBUFFER_INCOMPLETE_FORMATS = GL.GL_FRAMEBUFFER_INCOMPLETE_FORMATS; + public static final int FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER = GL2.GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER; + public static final int FRAMEBUFFER_INCOMPLETE_READ_BUFFER = GL2.GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER; + public static final int FRAMEBUFFER_UNSUPPORTED = GL.GL_FRAMEBUFFER_UNSUPPORTED; - public static final int GL_STATIC_DRAW = GL.GL_STATIC_DRAW; - public static final int GL_DYNAMIC_DRAW = GL.GL_DYNAMIC_DRAW; - public static final int GL_STREAM_DRAW = GL2.GL_STREAM_DRAW; + public static final int STATIC_DRAW = GL.GL_STATIC_DRAW; + public static final int DYNAMIC_DRAW = GL.GL_DYNAMIC_DRAW; + public static final int STREAM_DRAW = GL2.GL_STREAM_DRAW; - public static final int GL_READ_ONLY = GL2.GL_READ_ONLY; - public static final int GL_WRITE_ONLY = GL2.GL_WRITE_ONLY; - public static final int GL_READ_WRITE = GL2.GL_READ_WRITE; + public static final int READ_ONLY = GL2.GL_READ_ONLY; + public static final int WRITE_ONLY = GL2.GL_WRITE_ONLY; + public static final int READ_WRITE = GL2.GL_READ_WRITE; - public static final int GL_TRIANGLE_FAN = GL.GL_TRIANGLE_FAN; - public static final int GL_TRIANGLE_STRIP = GL.GL_TRIANGLE_STRIP; - public static final int GL_TRIANGLES = GL.GL_TRIANGLES; + public static final int TRIANGLE_FAN = GL.GL_TRIANGLE_FAN; + public static final int TRIANGLE_STRIP = GL.GL_TRIANGLE_STRIP; + public static final int TRIANGLES = GL.GL_TRIANGLES; - public static final int GL_VENDOR = GL.GL_VENDOR; - public static final int GL_RENDERER = GL.GL_RENDERER; - public static final int GL_VERSION = GL.GL_VERSION; - public static final int GL_EXTENSIONS = GL.GL_EXTENSIONS; - public static final int GL_SHADING_LANGUAGE_VERSION = GL2ES2.GL_SHADING_LANGUAGE_VERSION; + public static final int VENDOR = GL.GL_VENDOR; + public static final int RENDERER = GL.GL_RENDERER; + public static final int VERSION = GL.GL_VERSION; + public static final int EXTENSIONS = GL.GL_EXTENSIONS; + public static final int SHADING_LANGUAGE_VERSION = GL2ES2.GL_SHADING_LANGUAGE_VERSION; - public static final int GL_MAX_TEXTURE_SIZE = GL.GL_MAX_TEXTURE_SIZE; - public static final int GL_MAX_SAMPLES = GL2.GL_MAX_SAMPLES; - public static final int GL_ALIASED_LINE_WIDTH_RANGE = GL.GL_ALIASED_LINE_WIDTH_RANGE; - public static final int GL_ALIASED_POINT_SIZE_RANGE = GL.GL_ALIASED_POINT_SIZE_RANGE; - public static final int GL_DEPTH_BITS = GL.GL_DEPTH_BITS; - public static final int GL_STENCIL_BITS = GL.GL_STENCIL_BITS; + public static final int MAX_TEXTURE_SIZE = GL.GL_MAX_TEXTURE_SIZE; + public static final int MAX_SAMPLES = GL2.GL_MAX_SAMPLES; + public static final int ALIASED_LINE_WIDTH_RANGE = GL.GL_ALIASED_LINE_WIDTH_RANGE; + public static final int ALIASED_POINT_SIZE_RANGE = GL.GL_ALIASED_POINT_SIZE_RANGE; + public static final int DEPTH_BITS = GL.GL_DEPTH_BITS; + public static final int STENCIL_BITS = GL.GL_STENCIL_BITS; - public static final int GLU_TESS_WINDING_NONZERO = GLU.GLU_TESS_WINDING_NONZERO; - public static final int GLU_TESS_WINDING_ODD = GLU.GLU_TESS_WINDING_ODD; + public static final int TESS_WINDING_NONZERO = GLU.GLU_TESS_WINDING_NONZERO; + public static final int TESS_WINDING_ODD = GLU.GLU_TESS_WINDING_ODD; - public static final int GL_TEXTURE0 = GL.GL_TEXTURE0; - public static final int GL_TEXTURE1 = GL.GL_TEXTURE1; - public static final int GL_TEXTURE2 = GL.GL_TEXTURE2; - public static final int GL_TEXTURE3 = GL.GL_TEXTURE3; - public static final int GL_TEXTURE_MIN_FILTER = GL.GL_TEXTURE_MIN_FILTER; - public static final int GL_TEXTURE_MAG_FILTER = GL.GL_TEXTURE_MAG_FILTER; - public static final int GL_TEXTURE_WRAP_S = GL.GL_TEXTURE_WRAP_S; - public static final int GL_TEXTURE_WRAP_T = GL.GL_TEXTURE_WRAP_T; + public static final int TEXTURE0 = GL.GL_TEXTURE0; + public static final int TEXTURE1 = GL.GL_TEXTURE1; + public static final int TEXTURE2 = GL.GL_TEXTURE2; + public static final int TEXTURE3 = GL.GL_TEXTURE3; + public static final int TEXTURE_MIN_FILTER = GL.GL_TEXTURE_MIN_FILTER; + public static final int TEXTURE_MAG_FILTER = GL.GL_TEXTURE_MAG_FILTER; + public static final int TEXTURE_WRAP_S = GL.GL_TEXTURE_WRAP_S; + public static final int TEXTURE_WRAP_T = GL.GL_TEXTURE_WRAP_T; - public static final int GL_BLEND = GL.GL_BLEND; - public static final int GL_ONE = GL.GL_ONE; - public static final int GL_ZERO = GL.GL_ZERO; - public static final int GL_SRC_ALPHA = GL.GL_SRC_ALPHA; - public static final int GL_DST_ALPHA = GL.GL_DST_ALPHA; - public static final int GL_ONE_MINUS_SRC_ALPHA = GL.GL_ONE_MINUS_SRC_ALPHA; - public static final int GL_ONE_MINUS_DST_COLOR = GL.GL_ONE_MINUS_DST_COLOR; - public static final int GL_ONE_MINUS_SRC_COLOR = GL.GL_ONE_MINUS_SRC_COLOR; - public static final int GL_DST_COLOR = GL.GL_DST_COLOR; - public static final int GL_SRC_COLOR = GL.GL_SRC_COLOR; + public static final int BLEND = GL.GL_BLEND; + public static final int ONE = GL.GL_ONE; + public static final int ZERO = GL.GL_ZERO; + public static final int SRC_ALPHA = GL.GL_SRC_ALPHA; + public static final int DST_ALPHA = GL.GL_DST_ALPHA; + public static final int ONE_MINUS_SRC_ALPHA = GL.GL_ONE_MINUS_SRC_ALPHA; + public static final int ONE_MINUS_DST_COLOR = GL.GL_ONE_MINUS_DST_COLOR; + public static final int ONE_MINUS_SRC_COLOR = GL.GL_ONE_MINUS_SRC_COLOR; + public static final int DST_COLOR = GL.GL_DST_COLOR; + public static final int SRC_COLOR = GL.GL_SRC_COLOR; - public static final int GL_FRAMEBUFFER = GL.GL_FRAMEBUFFER; - public static final int GL_COLOR_ATTACHMENT0 = GL.GL_COLOR_ATTACHMENT0; - public static final int GL_COLOR_ATTACHMENT1 = GL2.GL_COLOR_ATTACHMENT1; - public static final int GL_COLOR_ATTACHMENT2 = GL2.GL_COLOR_ATTACHMENT2; - public static final int GL_COLOR_ATTACHMENT3 = GL2.GL_COLOR_ATTACHMENT3; - public static final int GL_RENDERBUFFER = GL.GL_RENDERBUFFER; - public static final int GL_DEPTH_ATTACHMENT = GL.GL_DEPTH_ATTACHMENT; - public static final int GL_STENCIL_ATTACHMENT = GL.GL_STENCIL_ATTACHMENT; - public static final int GL_READ_FRAMEBUFFER = GL2.GL_READ_FRAMEBUFFER; - public static final int GL_DRAW_FRAMEBUFFER = GL2.GL_DRAW_FRAMEBUFFER; + public static final int FRAMEBUFFER = GL.GL_FRAMEBUFFER; + public static final int COLOR_ATTACHMENT0 = GL.GL_COLOR_ATTACHMENT0; + public static final int COLOR_ATTACHMENT1 = GL2.GL_COLOR_ATTACHMENT1; + public static final int COLOR_ATTACHMENT2 = GL2.GL_COLOR_ATTACHMENT2; + public static final int COLOR_ATTACHMENT3 = GL2.GL_COLOR_ATTACHMENT3; + public static final int RENDERBUFFER = GL.GL_RENDERBUFFER; + public static final int DEPTH_ATTACHMENT = GL.GL_DEPTH_ATTACHMENT; + public static final int STENCIL_ATTACHMENT = GL.GL_STENCIL_ATTACHMENT; + public static final int READ_FRAMEBUFFER = GL2.GL_READ_FRAMEBUFFER; + public static final int DRAW_FRAMEBUFFER = GL2.GL_DRAW_FRAMEBUFFER; - public static final int GL_VERTEX_SHADER = GL2.GL_VERTEX_SHADER; - public static final int GL_FRAGMENT_SHADER = GL2.GL_FRAGMENT_SHADER; - public static final int GL_INFO_LOG_LENGTH = GL2.GL_INFO_LOG_LENGTH; - public static final int GL_SHADER_SOURCE_LENGTH = GL2.GL_SHADER_SOURCE_LENGTH; - public static final int GL_COMPILE_STATUS = GL2.GL_COMPILE_STATUS; - public static final int GL_LINK_STATUS = GL2.GL_LINK_STATUS; - public static final int GL_VALIDATE_STATUS = GL2.GL_VALIDATE_STATUS; + public static final int VERTEX_SHADER = GL2.GL_VERTEX_SHADER; + public static final int FRAGMENT_SHADER = GL2.GL_FRAGMENT_SHADER; + public static final int INFO_LOG_LENGTH = GL2.GL_INFO_LOG_LENGTH; + public static final int SHADER_SOURCE_LENGTH = GL2.GL_SHADER_SOURCE_LENGTH; + public static final int COMPILE_STATUS = GL2.GL_COMPILE_STATUS; + public static final int LINK_STATUS = GL2.GL_LINK_STATUS; + public static final int VALIDATE_STATUS = GL2.GL_VALIDATE_STATUS; - public static final int GL_MULTISAMPLE = GL.GL_MULTISAMPLE; - public static final int GL_POINT_SMOOTH = GL2.GL_POINT_SMOOTH; - public static final int GL_LINE_SMOOTH = GL.GL_LINE_SMOOTH; - public static final int GL_POLYGON_SMOOTH = GL2.GL_POLYGON_SMOOTH; + public static final int MULTISAMPLE = GL.GL_MULTISAMPLE; + public static final int POINT_SMOOTH = GL2.GL_POINT_SMOOTH; + public static final int LINE_SMOOTH = GL.GL_LINE_SMOOTH; + public static final int POLYGON_SMOOTH = GL2.GL_POLYGON_SMOOTH; /** Basic GL functionality, common to all profiles */ public GL gl; @@ -939,17 +939,17 @@ public class PGL { // Caps query - public String glGetString(int name) { + public String getString(int name) { return gl.glGetString(name); } - public void glGetIntegerv(int name, int[] values, int offset) { + public void getIntegerv(int name, int[] values, int offset) { gl.glGetIntegerv(name, values, offset); } - public void glGetBooleanv(int name, boolean[] values, int offset) { + public void getBooleanv(int name, boolean[] values, int offset) { if (-1 < name) { byte[] bvalues = new byte[values.length]; gl.glGetBooleanv(name, bvalues, offset); @@ -967,14 +967,14 @@ public class PGL { // Enable/disable caps - public void glEnable(int cap) { + public void enable(int cap) { if (-1 < cap) { gl.glEnable(cap); } } - public void glDisable(int cap) { + public void disable(int cap) { if (-1 < cap) { gl.glDisable(cap); } @@ -986,12 +986,12 @@ public class PGL { // Render control - public void glFlush() { + public void flush() { gl.glFlush(); } - public void glFinish() { + public void finish() { gl.glFinish(); } @@ -1001,42 +1001,37 @@ public class PGL { // Error handling - public int glGetError() { + public int getError() { return gl.glGetError(); } - public String glErrorString(int err) { + public String errorString(int err) { return glu.gluErrorString(err); } - - public String gluErrorString(int err) { - return glu.gluErrorString(err); - } - - + ///////////////////////////////////////////////////////////////////////////////// // Rendering options - public void glFrontFace(int mode) { + public void frontFace(int mode) { gl.glFrontFace(mode); } - public void glCullFace(int mode) { + public void cullFace(int mode) { gl.glCullFace(mode); } - public void glDepthMask(boolean flag) { + public void depthMask(boolean flag) { gl.glDepthMask(flag); } - public void glDepthFunc(int func) { + public void depthFunc(int func) { gl.glDepthFunc(func); } @@ -1046,52 +1041,52 @@ public class PGL { // Textures - public void glGenTextures(int n, int[] ids, int offset) { + public void genTextures(int n, int[] ids, int offset) { gl.glGenTextures(n, ids, offset); } - public void glDeleteTextures(int n, int[] ids, int offset) { + public void deleteTextures(int n, int[] ids, int offset) { gl.glDeleteTextures(n, ids, offset); } - public void glActiveTexture(int unit) { + public void activeTexture(int unit) { gl.glActiveTexture(unit); } - public void glBindTexture(int target, int id) { + public void bindTexture(int target, int id) { gl.glBindTexture(target, id); - if (target == GL_TEXTURE_2D) { + if (target == TEXTURE_2D) { boundTextures[0] = id; - } else if (target == GL_TEXTURE_RECTANGLE) { + } else if (target == TEXTURE_RECTANGLE) { boundTextures[1] = id; } } - public void glTexImage2D(int target, int level, int internalFormat, int width, int height, int border, int format, int type, Buffer data) { + public void texImage2D(int target, int level, int internalFormat, int width, int height, int border, int format, int type, Buffer data) { gl.glTexImage2D(target, level, internalFormat, width, height, border, format, type, data); } - public void glTexSubImage2D(int target, int level, int xOffset, int yOffset, int width, int height, int format, int type, Buffer data) { + public void texSubImage2D(int target, int level, int xOffset, int yOffset, int width, int height, int format, int type, Buffer data) { gl.glTexSubImage2D(target, level, xOffset, yOffset, width, height, format, type, data); } - public void glTexParameteri(int target, int param, int value) { + public void texParameteri(int target, int param, int value) { gl.glTexParameteri(target, param, value); } - public void glGetTexParameteriv(int target, int param, int[] values, int offset) { + public void getTexParameteriv(int target, int param, int[] values, int offset) { gl.glGetTexParameteriv(target, param, values, offset); } - public void glGenerateMipmap(int target) { + public void generateMipmap(int target) { gl.glGenerateMipmap(target); } @@ -1101,67 +1096,67 @@ public class PGL { // Vertex Buffers - public void glGenBuffers(int n, int[] ids, int offset) { + public void genBuffers(int n, int[] ids, int offset) { gl.glGenBuffers(n, ids, offset); } - public void glDeleteBuffers(int n, int[] ids, int offset) { + public void deleteBuffers(int n, int[] ids, int offset) { gl.glDeleteBuffers(n, ids, offset); } - public void glBindBuffer(int target, int id) { + public void bindBuffer(int target, int id) { gl.glBindBuffer(target, id); } - public void glBufferData(int target, int size, Buffer data, int usage) { + public void bufferData(int target, int size, Buffer data, int usage) { gl.glBufferData(target, size, data, usage); } - public void glBufferSubData(int target, int offset, int size, Buffer data) { + public void bufferSubData(int target, int offset, int size, Buffer data) { gl.glBufferSubData(target, offset, size, data); } - public void glDrawArrays(int mode, int first, int count) { + public void drawArrays(int mode, int first, int count) { gl.glDrawArrays(mode, first, count); } - public void glDrawElements(int mode, int count, int type, int offset) { + public void drawElements(int mode, int count, int type, int offset) { gl.glDrawElements(mode, count, type, offset); } - public void glEnableVertexAttribArray(int loc) { + public void enableVertexAttribArray(int loc) { gl2.glEnableVertexAttribArray(loc); } - public void glDisableVertexAttribArray(int loc) { + public void disableVertexAttribArray(int loc) { gl2.glDisableVertexAttribArray(loc); } - public void glVertexAttribPointer(int loc, int size, int type, boolean normalized, int stride, int offset) { + public void vertexAttribPointer(int loc, int size, int type, boolean normalized, int stride, int offset) { gl2.glVertexAttribPointer(loc, size, type, normalized, stride, offset); } - public void glVertexAttribPointer(int loc, int size, int type, boolean normalized, int stride, Buffer data) { + public void vertexAttribPointer(int loc, int size, int type, boolean normalized, int stride, Buffer data) { gl2.glVertexAttribPointer(loc, size, type, normalized, stride, data); } - public ByteBuffer glMapBuffer(int target, int access) { + public ByteBuffer mapBuffer(int target, int access) { return gl2.glMapBuffer(target, access); } - public ByteBuffer glMapBufferRange(int target, int offset, int length, int access) { + public ByteBuffer mapBufferRange(int target, int offset, int length, int access) { if (gl2x != null) { return gl2x.glMapBufferRange(target, offset, length, access); } else { @@ -1170,7 +1165,7 @@ public class PGL { } - public void glUnmapBuffer(int target) { + public void unmapBuffer(int target) { gl2.glUnmapBuffer(target); } @@ -1180,66 +1175,66 @@ public class PGL { // Framebuffers, renderbuffers - public void glGenFramebuffers(int n, int[] ids, int offset) { + public void genFramebuffers(int n, int[] ids, int offset) { gl.glGenFramebuffers(n, ids, offset); } - public void glDeleteFramebuffers(int n, int[] ids, int offset) { + public void deleteFramebuffers(int n, int[] ids, int offset) { gl.glDeleteFramebuffers(n, ids, offset); } - public void glGenRenderbuffers(int n, int[] ids, int offset) { + public void genRenderbuffers(int n, int[] ids, int offset) { gl.glGenRenderbuffers(n, ids, offset); } - public void glDeleteRenderbuffers(int n, int[] ids, int offset) { + public void deleteRenderbuffers(int n, int[] ids, int offset) { gl.glDeleteRenderbuffers(n, ids, offset); } - public void glBindFramebuffer(int target, int id) { + public void bindFramebuffer(int target, int id) { gl.glBindFramebuffer(target, id); } - public void glBlitFramebuffer(int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1, int mask, int filter) { + public void blitFramebuffer(int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1, int mask, int filter) { if (gl2x != null) { gl2x.glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); } } - public void glFramebufferTexture2D(int target, int attachment, int texTarget, int texId, int level) { + public void framebufferTexture2D(int target, int attachment, int texTarget, int texId, int level) { gl.glFramebufferTexture2D(target, attachment, texTarget, texId, level); } - public void glBindRenderbuffer(int target, int id) { + public void bindRenderbuffer(int target, int id) { gl.glBindRenderbuffer(target, id); } - public void glRenderbufferStorageMultisample(int target, int samples, int format, int width, int height) { + public void renderbufferStorageMultisample(int target, int samples, int format, int width, int height) { if (gl2x != null) { gl2x.glRenderbufferStorageMultisample(target, samples, format, width, height); } } - public void glRenderbufferStorage(int target, int format, int width, int height) { + public void renderbufferStorage(int target, int format, int width, int height) { gl.glRenderbufferStorage(target, format, width, height); } - public void glFramebufferRenderbuffer(int target, int attachment, int rendbufTarget, int rendbufId) { + public void framebufferRenderbuffer(int target, int attachment, int rendbufTarget, int rendbufId) { gl.glFramebufferRenderbuffer(target, attachment, rendbufTarget, rendbufId); } - public int glCheckFramebufferStatus(int target) { + public int checkFramebufferStatus(int target) { return gl.glCheckFramebufferStatus(target); } @@ -1249,207 +1244,207 @@ public class PGL { // Shaders - public int glCreateProgram() { + public int createProgram() { return gl2.glCreateProgram(); } - public void glDeleteProgram(int id) { + public void deleteProgram(int id) { gl2.glDeleteProgram(id); } - public int glCreateShader(int type) { + public int createShader(int type) { return gl2.glCreateShader(type); } - public void glDeleteShader(int id) { + public void deleteShader(int id) { gl2.glDeleteShader(id); } - public void glLinkProgram(int prog) { + public void linkProgram(int prog) { gl2.glLinkProgram(prog); } - public void glValidateProgram(int prog) { + public void validateProgram(int prog) { gl2.glValidateProgram(prog); } - public void glUseProgram(int prog) { + public void useProgram(int prog) { gl2.glUseProgram(prog); } - public int glGetAttribLocation(int prog, String name) { + public int getAttribLocation(int prog, String name) { return gl2.glGetAttribLocation(prog, name); } - public int glGetUniformLocation(int prog, String name) { + public int getUniformLocation(int prog, String name) { return gl2.glGetUniformLocation(prog, name); } - public void glUniform1i(int loc, int value) { + public void uniform1i(int loc, int value) { gl2.glUniform1i(loc, value); } - public void glUniform2i(int loc, int value0, int value1) { + public void uniform2i(int loc, int value0, int value1) { gl2.glUniform2i(loc, value0, value1); } - public void glUniform3i(int loc, int value0, int value1, int value2) { + public void uniform3i(int loc, int value0, int value1, int value2) { gl2.glUniform3i(loc, value0, value1, value2); } - public void glUniform4i(int loc, int value0, int value1, int value2, int value3) { + public void uniform4i(int loc, int value0, int value1, int value2, int value3) { gl2.glUniform4i(loc, value0, value1, value2, value3); } - public void glUniform1f(int loc, float value) { + public void uniform1f(int loc, float value) { gl2.glUniform1f(loc, value); } - public void glUniform2f(int loc, float value0, float value1) { + public void uniform2f(int loc, float value0, float value1) { gl2.glUniform2f(loc, value0, value1); } - public void glUniform3f(int loc, float value0, float value1, float value2) { + public void uniform3f(int loc, float value0, float value1, float value2) { gl2.glUniform3f(loc, value0, value1, value2); } - public void glUniform4f(int loc, float value0, float value1, float value2, float value3) { + public void uniform4f(int loc, float value0, float value1, float value2, float value3) { gl2.glUniform4f(loc, value0, value1, value2, value3); } - public void glUniform1iv(int loc, int count, int[] v, int offset) { + public void uniform1iv(int loc, int count, int[] v, int offset) { gl2.glUniform1iv(loc, count, v, offset); } - public void glUniform2iv(int loc, int count, int[] v, int offset) { + public void uniform2iv(int loc, int count, int[] v, int offset) { gl2.glUniform2iv(loc, count, v, offset); } - public void glUniform3iv(int loc, int count, int[] v, int offset) { + public void uniform3iv(int loc, int count, int[] v, int offset) { gl2.glUniform3iv(loc, count, v, offset); } - public void glUniform4iv(int loc, int count, int[] v, int offset) { + public void uniform4iv(int loc, int count, int[] v, int offset) { gl2.glUniform4iv(loc, count, v, offset); } - public void glUniform1fv(int loc, int count, float[] v, int offset) { + public void uniform1fv(int loc, int count, float[] v, int offset) { gl2.glUniform1fv(loc, count, v, offset); } - public void glUniform2fv(int loc, int count, float[] v, int offset) { + public void uniform2fv(int loc, int count, float[] v, int offset) { gl2.glUniform2fv(loc, count, v, offset); } - public void glUniform3fv(int loc, int count, float[] v, int offset) { + public void uniform3fv(int loc, int count, float[] v, int offset) { gl2.glUniform3fv(loc, count, v, offset); } - public void glUniform4fv(int loc, int count, float[] v, int offset) { + public void uniform4fv(int loc, int count, float[] v, int offset) { gl2.glUniform4fv(loc, count, v, offset); } - public void glUniformMatrix2fv(int loc, int count, boolean transpose, float[] mat, int offset) { + public void uniformMatrix2fv(int loc, int count, boolean transpose, float[] mat, int offset) { gl2.glUniformMatrix2fv(loc, count, transpose, mat, offset); } - public void glUniformMatrix3fv(int loc, int count, boolean transpose, float[] mat, int offset) { + public void uniformMatrix3fv(int loc, int count, boolean transpose, float[] mat, int offset) { gl2.glUniformMatrix3fv(loc, count, transpose, mat, offset); } - public void glUniformMatrix4fv(int loc, int count, boolean transpose, float[] mat, int offset) { + public void uniformMatrix4fv(int loc, int count, boolean transpose, float[] mat, int offset) { gl2.glUniformMatrix4fv(loc, count, transpose, mat, offset); } - public void glVertexAttrib1f(int loc, float value) { + public void vertexAttrib1f(int loc, float value) { gl2.glVertexAttrib1f(loc, value); } - public void glVertexAttrib2f(int loc, float value0, float value1) { + public void vertexAttrib2f(int loc, float value0, float value1) { gl2.glVertexAttrib2f(loc, value0, value1); } - public void glVertexAttrib3f(int loc, float value0, float value1, float value2) { + public void vertexAttrib3f(int loc, float value0, float value1, float value2) { gl2.glVertexAttrib3f(loc, value0, value1, value2); } - public void glVertexAttrib4f(int loc, float value0, float value1, float value2, float value3) { + public void vertexAttrib4f(int loc, float value0, float value1, float value2, float value3) { gl2.glVertexAttrib4f(loc, value0, value1, value2, value3); } - public void glVertexAttrib1fv(int loc, float[] v, int offset) { + public void vertexAttrib1fv(int loc, float[] v, int offset) { gl2.glVertexAttrib1fv(loc, v, offset); } - public void glVertexAttrib2fv(int loc, float[] v, int offset) { + public void vertexAttrib2fv(int loc, float[] v, int offset) { gl2.glVertexAttrib2fv(loc, v, offset); } - public void glVertexAttrib3fv(int loc, float[] v, int offset) { + public void vertexAttrib3fv(int loc, float[] v, int offset) { gl2.glVertexAttrib3fv(loc, v, offset); } - public void glVertexAttrib4fv(int loc, float[] v, int offset) { + public void vertexAttrib4fv(int loc, float[] v, int offset) { gl2.glVertexAttrib4fv(loc, v, offset); } - public void glShaderSource(int id, String source) { + public void shaderSource(int id, String source) { gl2.glShaderSource(id, 1, new String[] { source }, (int[]) null, 0); } - public void glCompileShader(int id) { + public void compileShader(int id) { gl2.glCompileShader(id); } - public void glAttachShader(int prog, int shader) { + public void attachShader(int prog, int shader) { gl2.glAttachShader(prog, shader); } - public void glGetShaderiv(int shader, int pname, int[] params, int offset) { + public void getShaderiv(int shader, int pname, int[] params, int offset) { gl2.glGetShaderiv(shader, pname, params, offset); } - public String glGetShaderInfoLog(int shader) { + public String getShaderInfoLog(int shader) { int[] val = { 0 }; gl2.glGetShaderiv(shader, GL2.GL_INFO_LOG_LENGTH, val, 0); int length = val[0]; @@ -1460,12 +1455,12 @@ public class PGL { } - public void glGetProgramiv(int prog, int pname, int[] params, int offset) { + public void getProgramiv(int prog, int pname, int[] params, int offset) { gl2.glGetProgramiv(prog, pname, params, offset); } - public String glGetProgramInfoLog(int prog) { + public String getProgramInfoLog(int prog) { int[] val = { 0 }; gl2.glGetShaderiv(prog, GL2.GL_INFO_LOG_LENGTH, val, 0); int length = val[0]; @@ -1481,7 +1476,7 @@ public class PGL { // Viewport - public void glViewport(int x, int y, int width, int height) { + public void viewport(int x, int y, int width, int height) { gl.glViewport(x, y, width, height); } @@ -1491,7 +1486,7 @@ public class PGL { // Clipping (scissor test) - public void glScissor(int x, int y, int w, int h) { + public void scissor(int x, int y, int w, int h) { gl.glScissor(x, y, w, h); } @@ -1501,12 +1496,12 @@ public class PGL { // Blending - public void glBlendEquation(int eq) { + public void blendEquation(int eq) { gl.glBlendEquation(eq); } - public void glBlendFunc(int srcFactor, int dstFactor) { + public void blendFunc(int srcFactor, int dstFactor) { gl.glBlendFunc(srcFactor, dstFactor); } @@ -1516,46 +1511,46 @@ public class PGL { // Pixels - public void glReadBuffer(int buf) { + public void readBuffer(int buf) { if (gl2x != null) { gl2x.glReadBuffer(buf); } } - public void glReadPixels(int x, int y, int width, int height, int format, int type, Buffer buffer) { + public void readPixels(int x, int y, int width, int height, int format, int type, Buffer buffer) { gl.glReadPixels(x, y, width, height, format, type, buffer); } - public void glDrawBuffer(int buf) { + public void drawBuffer(int buf) { if (gl2x != null) { gl2x.glDrawBuffer(buf); } } - public void glClearDepth(float d) { + public void clearDepth(float d) { gl.glClearDepthf(d); } - public void glClearStencil(int s) { + public void clearStencil(int s) { gl.glClearStencil(s); } - public void glColorMask(boolean wr, boolean wg, boolean wb, boolean wa) { + public void colorMask(boolean wr, boolean wg, boolean wb, boolean wa) { gl.glColorMask(wr, wg, wb, wa); } - public void glClearColor(float r, float g, float b, float a) { + public void clearColor(float r, float g, float b, float a) { gl.glClearColor(r, g, b, a); } - public void glClear(int mask) { + public void clear(int mask) { gl.glClear(mask); } @@ -1660,7 +1655,7 @@ public class PGL { public void addVertex(double[] v) { GLU.gluTessVertex(tess, v, 0, v); } - + protected class GLUCallback extends GLUtessellatorCallbackAdapter { public void begin(int type) { callback.begin(type); @@ -1685,6 +1680,9 @@ public class PGL { } } + protected String tessError(int err) { + return glu.gluErrorString(err); + } public interface TessellatorCallback { public void begin(int type); @@ -1707,29 +1705,29 @@ public class PGL { public void enableTexturing(int target) { - glEnable(target); - if (target == GL_TEXTURE_2D) { + enable(target); + if (target == TEXTURE_2D) { texturingTargets[0] = true; - } else if (target == GL_TEXTURE_RECTANGLE) { + } else if (target == TEXTURE_RECTANGLE) { texturingTargets[1] = true; } } public void disableTexturing(int target) { - glDisable(target); - if (target == GL_TEXTURE_2D) { + disable(target); + if (target == TEXTURE_2D) { texturingTargets[0] = false; - } else if (target == GL_TEXTURE_RECTANGLE) { + } else if (target == TEXTURE_RECTANGLE) { texturingTargets[1] = false; } } public boolean texturingIsEnabled(int target) { - if (target == GL_TEXTURE_2D) { + if (target == TEXTURE_2D) { return texturingTargets[0]; - } else if (target == GL_TEXTURE_RECTANGLE) { + } else if (target == TEXTURE_RECTANGLE) { return texturingTargets[1]; } else { return false; @@ -1738,9 +1736,9 @@ public class PGL { public boolean textureIsBound(int target, int id) { - if (target == GL_TEXTURE_2D) { + if (target == TEXTURE_2D) { return boundTextures[0] == id; - } else if (target == GL_TEXTURE_RECTANGLE) { + } else if (target == TEXTURE_RECTANGLE) { return boundTextures[1] == id; } else { return false; @@ -1750,20 +1748,20 @@ public class PGL { public void initTexture(int target, int format, int width, int height) { int[] texels = new int[width * height]; - glTexSubImage2D(target, 0, 0, 0, width, height, format, GL_UNSIGNED_BYTE, IntBuffer.wrap(texels)); + texSubImage2D(target, 0, 0, 0, width, height, format, UNSIGNED_BYTE, IntBuffer.wrap(texels)); } public void copyToTexture(int target, int format, int id, int x, int y, int w, int h, IntBuffer buffer) { - glActiveTexture(GL_TEXTURE0); + activeTexture(TEXTURE0); boolean enabledTex = false; if (!texturingIsEnabled(target)) { enableTexturing(target); enabledTex = true; } - glBindTexture(target, id); - glTexSubImage2D(target, 0, x, y, w, h, format, GL_UNSIGNED_BYTE, buffer); - glBindTexture(target, 0); + bindTexture(target, id); + texSubImage2D(target, 0, x, y, w, h, format, UNSIGNED_BYTE, buffer); + bindTexture(target, 0); if (enabledTex) { disableTexturing(target); } @@ -1778,11 +1776,11 @@ public class PGL { public void drawTexture(int target, int id, int width, int height, int texX0, int texY0, int texX1, int texY1, int scrX0, int scrY0, int scrX1, int scrY1) { - if (target == GL_TEXTURE_2D) { + if (target == TEXTURE_2D) { drawTexture2D(id, width, height, texX0, texY0, texX1, texY1, scrX0, scrY0, scrX1, scrY1); - } else if (target == GL_TEXTURE_RECTANGLE) { + } else if (target == TEXTURE_RECTANGLE) { drawTextureRect(id, width, height, texX0, texY0, texX1, texY1, scrX0, scrY0, scrX1, scrY1); @@ -1793,14 +1791,14 @@ public class PGL { int texX0, int texY0, int texX1, int texY1, int scrX0, int scrY0, int scrX1, int scrY1) { if (!loadedTex2DShader || tex2DShaderContext.hashCode() != context.hashCode()) { - tex2DVertShader = createShader(GL_VERTEX_SHADER, texVertShaderSource); - tex2DFragShader = createShader(GL_FRAGMENT_SHADER, tex2DFragShaderSource); + tex2DVertShader = createShader(VERTEX_SHADER, texVertShaderSource); + tex2DFragShader = createShader(FRAGMENT_SHADER, tex2DFragShaderSource); if (0 < tex2DVertShader && 0 < tex2DFragShader) { tex2DShaderProgram = createProgram(tex2DVertShader, tex2DFragShader); } if (0 < tex2DShaderProgram) { - tex2DVertLoc = glGetAttribLocation(tex2DShaderProgram, "inVertex"); - tex2DTCoordLoc = glGetAttribLocation(tex2DShaderProgram, "inTexcoord"); + tex2DVertLoc = getAttribLocation(tex2DShaderProgram, "inVertex"); + tex2DTCoordLoc = getAttribLocation(tex2DShaderProgram, "inTexcoord"); } loadedTex2DShader = true; tex2DShaderContext = context; @@ -1813,21 +1811,21 @@ public class PGL { if (0 < tex2DShaderProgram) { // The texture overwrites anything drawn earlier. boolean[] depthTest = new boolean[1]; - glGetBooleanv(GL_DEPTH_TEST, depthTest, 0); - glDisable(GL_DEPTH_TEST); + getBooleanv(DEPTH_TEST, depthTest, 0); + disable(DEPTH_TEST); // When drawing the texture we don't write to the // depth mask, so the texture remains in the background // and can be occluded by anything drawn later, even if // if it is behind it. boolean[] depthMask = new boolean[1]; - glGetBooleanv(GL_DEPTH_WRITEMASK, depthMask, 0); - glDepthMask(false); + getBooleanv(DEPTH_WRITEMASK, depthMask, 0); + depthMask(false); - glUseProgram(tex2DShaderProgram); + useProgram(tex2DShaderProgram); - glEnableVertexAttribArray(tex2DVertLoc); - glEnableVertexAttribArray(tex2DTCoordLoc); + enableVertexAttribArray(tex2DVertLoc); + enableVertexAttribArray(tex2DTCoordLoc); // Vertex coordinates of the textured quad are specified // in normalized screen space (-1, 1): @@ -1855,39 +1853,39 @@ public class PGL { texData.rewind(); texData.put(texCoords); - glActiveTexture(GL_TEXTURE0); + activeTexture(TEXTURE0); boolean enabledTex = false; - if (!texturingIsEnabled(GL_TEXTURE_2D)) { - enableTexturing(GL_TEXTURE_2D); + if (!texturingIsEnabled(TEXTURE_2D)) { + enableTexturing(TEXTURE_2D); enabledTex = true; } - glBindTexture(GL_TEXTURE_2D, id); + bindTexture(TEXTURE_2D, id); - glBindBuffer(GL_ARRAY_BUFFER, 0); // Making sure that no VBO is bound at this point. + bindBuffer(ARRAY_BUFFER, 0); // Making sure that no VBO is bound at this point. texData.position(0); - glVertexAttribPointer(tex2DVertLoc, 2, GL_FLOAT, false, 4 * SIZEOF_FLOAT, texData); + vertexAttribPointer(tex2DVertLoc, 2, FLOAT, false, 4 * SIZEOF_FLOAT, texData); texData.position(2); - glVertexAttribPointer(tex2DTCoordLoc, 2, GL_FLOAT, false, 4 * SIZEOF_FLOAT, texData); + vertexAttribPointer(tex2DTCoordLoc, 2, FLOAT, false, 4 * SIZEOF_FLOAT, texData); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + drawArrays(TRIANGLE_STRIP, 0, 4); - glBindTexture(GL_TEXTURE_2D, 0); + bindTexture(TEXTURE_2D, 0); if (enabledTex) { - disableTexturing(GL_TEXTURE_2D); + disableTexturing(TEXTURE_2D); } - glDisableVertexAttribArray(tex2DVertLoc); - glDisableVertexAttribArray(tex2DTCoordLoc); + disableVertexAttribArray(tex2DVertLoc); + disableVertexAttribArray(tex2DTCoordLoc); - glUseProgram(0); + useProgram(0); if (depthTest[0]) { - glEnable(GL_DEPTH_TEST); + enable(DEPTH_TEST); } else { - glDisable(GL_DEPTH_TEST); + disable(DEPTH_TEST); } - glDepthMask(depthMask[0]); + depthMask(depthMask[0]); } } @@ -1896,14 +1894,14 @@ public class PGL { int texX0, int texY0, int texX1, int texY1, int scrX0, int scrY0, int scrX1, int scrY1) { if (!loadedTexRectShader || texRectShaderContext.hashCode() != context.hashCode()) { - texRectVertShader = createShader(GL_VERTEX_SHADER, texVertShaderSource); - texRectFragShader = createShader(GL_FRAGMENT_SHADER, texRectFragShaderSource); + texRectVertShader = createShader(VERTEX_SHADER, texVertShaderSource); + texRectFragShader = createShader(FRAGMENT_SHADER, texRectFragShaderSource); if (0 < texRectVertShader && 0 < texRectFragShader) { texRectShaderProgram = createProgram(texRectVertShader, texRectFragShader); } if (0 < texRectShaderProgram) { - texRectVertLoc = glGetAttribLocation(texRectShaderProgram, "inVertex"); - texRectTCoordLoc = glGetAttribLocation(texRectShaderProgram, "inTexcoord"); + texRectVertLoc = getAttribLocation(texRectShaderProgram, "inVertex"); + texRectTCoordLoc = getAttribLocation(texRectShaderProgram, "inTexcoord"); } loadedTexRectShader = true; texRectShaderContext = context; @@ -1916,21 +1914,21 @@ public class PGL { if (0 < texRectShaderProgram) { // The texture overwrites anything drawn earlier. boolean[] depthTest = new boolean[1]; - glGetBooleanv(GL_DEPTH_TEST, depthTest, 0); - glDisable(GL_DEPTH_TEST); + getBooleanv(DEPTH_TEST, depthTest, 0); + disable(DEPTH_TEST); // When drawing the texture we don't write to the // depth mask, so the texture remains in the background // and can be occluded by anything drawn later, even if // if it is behind it. boolean[] depthMask = new boolean[1]; - glGetBooleanv(GL_DEPTH_WRITEMASK, depthMask, 0); - glDepthMask(false); + getBooleanv(DEPTH_WRITEMASK, depthMask, 0); + depthMask(false); - glUseProgram(texRectShaderProgram); + useProgram(texRectShaderProgram); - glEnableVertexAttribArray(texRectVertLoc); - glEnableVertexAttribArray(texRectTCoordLoc); + enableVertexAttribArray(texRectVertLoc); + enableVertexAttribArray(texRectTCoordLoc); // Vertex coordinates of the textured quad are specified // in normalized screen space (-1, 1): @@ -1958,39 +1956,39 @@ public class PGL { texData.rewind(); texData.put(texCoords); - glActiveTexture(GL_TEXTURE0); + activeTexture(TEXTURE0); boolean enabledTex = false; - if (!texturingIsEnabled(GL_TEXTURE_RECTANGLE)) { - enableTexturing(GL_TEXTURE_RECTANGLE); + if (!texturingIsEnabled(TEXTURE_RECTANGLE)) { + enableTexturing(TEXTURE_RECTANGLE); enabledTex = true; } - glBindTexture(GL_TEXTURE_RECTANGLE, id); + bindTexture(TEXTURE_RECTANGLE, id); - glBindBuffer(GL_ARRAY_BUFFER, 0); // Making sure that no VBO is bound at this point. + bindBuffer(ARRAY_BUFFER, 0); // Making sure that no VBO is bound at this point. texData.position(0); - glVertexAttribPointer(texRectVertLoc, 2, GL_FLOAT, false, 4 * SIZEOF_FLOAT, texData); + vertexAttribPointer(texRectVertLoc, 2, FLOAT, false, 4 * SIZEOF_FLOAT, texData); texData.position(2); - glVertexAttribPointer(texRectTCoordLoc, 2, GL_FLOAT, false, 4 * SIZEOF_FLOAT, texData); + vertexAttribPointer(texRectTCoordLoc, 2, FLOAT, false, 4 * SIZEOF_FLOAT, texData); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + drawArrays(TRIANGLE_STRIP, 0, 4); - glBindTexture(GL_TEXTURE_RECTANGLE, 0); + bindTexture(TEXTURE_RECTANGLE, 0); if (enabledTex) { - disableTexturing(GL_TEXTURE_RECTANGLE); + disableTexturing(TEXTURE_RECTANGLE); } - glDisableVertexAttribArray(texRectVertLoc); - glDisableVertexAttribArray(texRectTCoordLoc); + disableVertexAttribArray(texRectVertLoc); + disableVertexAttribArray(texRectTCoordLoc); - glUseProgram(0); + useProgram(0); if (depthTest[0]) { - glEnable(GL_DEPTH_TEST); + enable(DEPTH_TEST); } else { - glDisable(GL_DEPTH_TEST); + disable(DEPTH_TEST); } - glDepthMask(depthMask[0]); + depthMask(depthMask[0]); } } @@ -1998,14 +1996,14 @@ public class PGL { public void drawRectangle(float r, float g, float b, float a, int scrX0, int scrY0, int scrX1, int scrY1) { if (!loadedRectShader || rectShaderContext.hashCode() != context.hashCode()) { - rectVertShader = createShader(GL_VERTEX_SHADER, rectVertShaderSource); - rectFragShader = createShader(GL_FRAGMENT_SHADER, rectFragShaderSource); + rectVertShader = createShader(VERTEX_SHADER, rectVertShaderSource); + rectFragShader = createShader(FRAGMENT_SHADER, rectFragShaderSource); if (0 < rectVertShader && 0 < rectFragShader) { rectShaderProgram = createProgram(rectVertShader, rectFragShader); } if (0 < rectShaderProgram) { - rectVertLoc = glGetAttribLocation(rectShaderProgram, "inVertex"); - rectColorLoc = glGetUniformLocation(rectShaderProgram, "rectColor"); + rectVertLoc = getAttribLocation(rectShaderProgram, "inVertex"); + rectColorLoc = getUniformLocation(rectShaderProgram, "rectColor"); } rectData = allocateDirectFloatBuffer(rectCoords.length); loadedRectShader = true; @@ -2015,21 +2013,21 @@ public class PGL { if (0 < rectShaderProgram) { // The rectangle overwrites anything drawn earlier. boolean[] depthTest = new boolean[1]; - glGetBooleanv(GL_DEPTH_TEST, depthTest, 0); - glDisable(GL_DEPTH_TEST); + getBooleanv(DEPTH_TEST, depthTest, 0); + disable(DEPTH_TEST); // When drawing the rectangle we don't write to the // depth mask, so the rectangle remains in the background // and can be occluded by anything drawn later, even if // if it is behind it. boolean[] depthMask = new boolean[1]; - glGetBooleanv(GL_DEPTH_WRITEMASK, depthMask, 0); - glDepthMask(false); + getBooleanv(DEPTH_WRITEMASK, depthMask, 0); + depthMask(false); - glUseProgram(rectShaderProgram); + useProgram(rectShaderProgram); - glEnableVertexAttribArray(rectVertLoc); - glUniform4f(rectColorLoc, r, g, b, a); + enableVertexAttribArray(rectVertLoc); + uniform4f(rectColorLoc, r, g, b, a); // Vertex coordinates of the rectangle are specified // in normalized screen space (-1, 1): @@ -2053,23 +2051,23 @@ public class PGL { rectData.rewind(); rectData.put(rectCoords); - glBindBuffer(GL_ARRAY_BUFFER, 0); // Making sure that no VBO is bound at this point. + bindBuffer(ARRAY_BUFFER, 0); // Making sure that no VBO is bound at this point. rectData.position(0); - glVertexAttribPointer(rectVertLoc, 2, GL_FLOAT, false, 2 * SIZEOF_FLOAT, rectData); + vertexAttribPointer(rectVertLoc, 2, FLOAT, false, 2 * SIZEOF_FLOAT, rectData); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + drawArrays(TRIANGLE_STRIP, 0, 4); - glDisableVertexAttribArray(rectVertLoc); + disableVertexAttribArray(rectVertLoc); - glUseProgram(0); + useProgram(0); if (depthTest[0]) { - glEnable(GL_DEPTH_TEST); + enable(DEPTH_TEST); } else { - glDisable(GL_DEPTH_TEST); + disable(DEPTH_TEST); } - glDepthMask(depthMask[0]); + depthMask(depthMask[0]); } } @@ -2079,7 +2077,7 @@ public class PGL { colorBuffer = IntBuffer.allocate(1); } colorBuffer.rewind(); - glReadPixels(scrX, pg.height - scrY - 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, colorBuffer); + readPixels(scrX, pg.height - scrY - 1, 1, 1, RGBA, UNSIGNED_BYTE, colorBuffer); return colorBuffer.get(); } @@ -2089,7 +2087,7 @@ public class PGL { depthBuffer = FloatBuffer.allocate(1); } depthBuffer.rewind(); - glReadPixels(scrX, pg.height - scrY - 1, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, depthBuffer); + readPixels(scrX, pg.height - scrY - 1, 1, 1, DEPTH_COMPONENT, FLOAT, depthBuffer); return depthBuffer.get(0); } @@ -2098,7 +2096,7 @@ public class PGL { if (stencilBuffer == null) { stencilBuffer = ByteBuffer.allocate(1); } - glReadPixels(scrX, pg.height - scrY - 1, 1, 1, GL_STENCIL_INDEX, GL.GL_UNSIGNED_BYTE, stencilBuffer); + readPixels(scrX, pg.height - scrY - 1, 1, 1, STENCIL_INDEX, GL.GL_UNSIGNED_BYTE, stencilBuffer); return stencilBuffer.get(0); } @@ -2409,16 +2407,16 @@ public class PGL { public int createShader(int shaderType, String source) { - int shader = glCreateShader(shaderType); + int shader = createShader(shaderType); if (shader != 0) { - glShaderSource(shader, source); - glCompileShader(shader); + shaderSource(shader, source); + compileShader(shader); int[] compiled = new int[1]; - glGetShaderiv(shader, GL_COMPILE_STATUS, compiled, 0); - if (compiled[0] == GL_FALSE) { + getShaderiv(shader, COMPILE_STATUS, compiled, 0); + if (compiled[0] == FALSE) { System.err.println("Could not compile shader " + shaderType + ":"); - System.err.println(glGetShaderInfoLog(shader)); - glDeleteShader(shader); + System.err.println(getShaderInfoLog(shader)); + deleteShader(shader); shader = 0; } } @@ -2427,17 +2425,17 @@ public class PGL { public int createProgram(int vertexShader, int fragmentShader) { - int program = glCreateProgram(); + int program = createProgram(); if (program != 0) { - glAttachShader(program, vertexShader); - glAttachShader(program, fragmentShader); - glLinkProgram(program); + attachShader(program, vertexShader); + attachShader(program, fragmentShader); + linkProgram(program); int[] linked = new int[1]; - glGetProgramiv(program, GL_LINK_STATUS, linked, 0); - if (linked[0] == GL_FALSE) { + getProgramiv(program, LINK_STATUS, linked, 0); + if (linked[0] == FALSE) { System.err.println("Could not link program: "); - System.err.println(glGetProgramInfoLog(program)); - glDeleteProgram(program); + System.err.println(getProgramInfoLog(program)); + deleteProgram(program); program = 0; } } @@ -2446,18 +2444,18 @@ public class PGL { public boolean validateFramebuffer() { - int status = glCheckFramebufferStatus(GL_FRAMEBUFFER); - if (status == GL_FRAMEBUFFER_COMPLETE) { + int status = checkFramebufferStatus(FRAMEBUFFER); + if (status == FRAMEBUFFER_COMPLETE) { return true; - } else if (status == GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT) { + } else if (status == FRAMEBUFFER_INCOMPLETE_ATTACHMENT) { throw new RuntimeException("PFramebuffer: GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT (" + Integer.toHexString(status) + ")"); - } else if (status == GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT) { + } else if (status == FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT) { throw new RuntimeException("PFramebuffer: GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT (" + Integer.toHexString(status) + ")"); - } else if (status == GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS) { + } else if (status == FRAMEBUFFER_INCOMPLETE_DIMENSIONS) { throw new RuntimeException("PFramebuffer: GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS (" + Integer.toHexString(status) + ")"); - } else if (status == GL_FRAMEBUFFER_INCOMPLETE_FORMATS) { + } else if (status == FRAMEBUFFER_INCOMPLETE_FORMATS) { throw new RuntimeException("PFramebuffer: GL_FRAMEBUFFER_INCOMPLETE_FORMATS (" + Integer.toHexString(status) + ")"); - } else if (status == GL_FRAMEBUFFER_UNSUPPORTED) { + } else if (status == FRAMEBUFFER_UNSUPPORTED) { throw new RuntimeException("PFramebuffer: GL_FRAMEBUFFER_UNSUPPORTED" + Integer.toHexString(status)); } else { throw new RuntimeException("PFramebuffer: unknown framebuffer error (" + Integer.toHexString(status) + ")"); diff --git a/core/src/processing/opengl/PGraphicsOpenGL.java b/core/src/processing/opengl/PGraphicsOpenGL.java index 6efebc8fe..753cf5079 100644 --- a/core/src/processing/opengl/PGraphicsOpenGL.java +++ b/core/src/processing/opengl/PGraphicsOpenGL.java @@ -611,7 +611,7 @@ public class PGraphicsOpenGL extends PGraphics { deleteFinalizedTextureObjects(); int[] temp = new int[1]; - pgl.glGenTextures(1, temp, 0); + pgl.genTextures(1, temp, 0); int id = temp[0]; GLResource res = new GLResource(id, context); @@ -629,7 +629,7 @@ public class PGraphicsOpenGL extends PGraphics { GLResource res = new GLResource(id, context); if (glTextureObjects.containsKey(res)) { int[] temp = { id }; - pgl.glDeleteTextures(1, temp, 0); + pgl.deleteTextures(1, temp, 0); glTextureObjects.remove(res); } } @@ -637,7 +637,7 @@ public class PGraphicsOpenGL extends PGraphics { protected void deleteAllTextureObjects() { for (GLResource res : glTextureObjects.keySet()) { int[] temp = { res.id }; - pgl.glDeleteTextures(1, temp, 0); + pgl.deleteTextures(1, temp, 0); } glTextureObjects.clear(); } @@ -657,7 +657,7 @@ public class PGraphicsOpenGL extends PGraphics { if (glTextureObjects.get(res)) { finalized.add(res); int[] temp = { res.id }; - pgl.glDeleteTextures(1, temp, 0); + pgl.deleteTextures(1, temp, 0); } } @@ -679,7 +679,7 @@ public class PGraphicsOpenGL extends PGraphics { deleteFinalizedVertexBufferObjects(); int[] temp = new int[1]; - pgl.glGenBuffers(1, temp, 0); + pgl.genBuffers(1, temp, 0); int id = temp[0]; GLResource res = new GLResource(id, context); @@ -697,7 +697,7 @@ public class PGraphicsOpenGL extends PGraphics { GLResource res = new GLResource(id, context); if (glVertexBuffers.containsKey(res)) { int[] temp = { id }; - pgl.glDeleteBuffers(1, temp, 0); + pgl.deleteBuffers(1, temp, 0); glVertexBuffers.remove(res); } } @@ -705,7 +705,7 @@ public class PGraphicsOpenGL extends PGraphics { protected void deleteAllVertexBufferObjects() { for (GLResource res : glVertexBuffers.keySet()) { int[] temp = { res.id }; - pgl.glDeleteBuffers(1, temp, 0); + pgl.deleteBuffers(1, temp, 0); } glVertexBuffers.clear(); } @@ -725,7 +725,7 @@ public class PGraphicsOpenGL extends PGraphics { if (glVertexBuffers.get(res)) { finalized.add(res); int[] temp = { res.id }; - pgl.glDeleteBuffers(1, temp, 0); + pgl.deleteBuffers(1, temp, 0); } } @@ -747,7 +747,7 @@ public class PGraphicsOpenGL extends PGraphics { deleteFinalizedFrameBufferObjects(); int[] temp = new int[1]; - pgl.glGenFramebuffers(1, temp, 0); + pgl.genFramebuffers(1, temp, 0); int id = temp[0]; GLResource res = new GLResource(id, context); @@ -765,7 +765,7 @@ public class PGraphicsOpenGL extends PGraphics { GLResource res = new GLResource(id, context); if (glFrameBuffers.containsKey(res)) { int[] temp = { id }; - pgl.glDeleteFramebuffers(1, temp, 0); + pgl.deleteFramebuffers(1, temp, 0); glFrameBuffers.remove(res); } } @@ -773,7 +773,7 @@ public class PGraphicsOpenGL extends PGraphics { protected void deleteAllFrameBufferObjects() { for (GLResource res : glFrameBuffers.keySet()) { int[] temp = { res.id }; - pgl.glDeleteFramebuffers(1, temp, 0); + pgl.deleteFramebuffers(1, temp, 0); } glFrameBuffers.clear(); } @@ -793,7 +793,7 @@ public class PGraphicsOpenGL extends PGraphics { if (glFrameBuffers.get(res)) { finalized.add(res); int[] temp = { res.id }; - pgl.glDeleteFramebuffers(1, temp, 0); + pgl.deleteFramebuffers(1, temp, 0); } } @@ -815,7 +815,7 @@ public class PGraphicsOpenGL extends PGraphics { deleteFinalizedRenderBufferObjects(); int[] temp = new int[1]; - pgl.glGenRenderbuffers(1, temp, 0); + pgl.genRenderbuffers(1, temp, 0); int id = temp[0]; GLResource res = new GLResource(id, context); @@ -833,7 +833,7 @@ public class PGraphicsOpenGL extends PGraphics { GLResource res = new GLResource(id, context); if (glRenderBuffers.containsKey(res)) { int[] temp = { id }; - pgl.glDeleteRenderbuffers(1, temp, 0); + pgl.deleteRenderbuffers(1, temp, 0); glRenderBuffers.remove(res); } } @@ -841,7 +841,7 @@ public class PGraphicsOpenGL extends PGraphics { protected void deleteAllRenderBufferObjects() { for (GLResource res : glRenderBuffers.keySet()) { int[] temp = { res.id }; - pgl.glDeleteRenderbuffers(1, temp, 0); + pgl.deleteRenderbuffers(1, temp, 0); } glRenderBuffers.clear(); } @@ -861,7 +861,7 @@ public class PGraphicsOpenGL extends PGraphics { if (glRenderBuffers.get(res)) { finalized.add(res); int[] temp = { res.id }; - pgl.glDeleteRenderbuffers(1, temp, 0); + pgl.deleteRenderbuffers(1, temp, 0); } } @@ -882,7 +882,7 @@ public class PGraphicsOpenGL extends PGraphics { protected int createGLSLProgramObject(int context) { deleteFinalizedGLSLProgramObjects(); - int id = pgl.glCreateProgram(); + int id = pgl.createProgram(); GLResource res = new GLResource(id, context); @@ -898,14 +898,14 @@ public class PGraphicsOpenGL extends PGraphics { protected void deleteGLSLProgramObject(int id, int context) { GLResource res = new GLResource(id, context); if (glslPrograms.containsKey(res)) { - pgl.glDeleteProgram(res.id); + pgl.deleteProgram(res.id); glslPrograms.remove(res); } } protected void deleteAllGLSLProgramObjects() { for (GLResource res : glslPrograms.keySet()) { - pgl.glDeleteProgram(res.id); + pgl.deleteProgram(res.id); } glslPrograms.clear(); } @@ -924,7 +924,7 @@ public class PGraphicsOpenGL extends PGraphics { for (GLResource res : glslPrograms.keySet()) { if (glslPrograms.get(res)) { finalized.add(res); - pgl.glDeleteProgram(res.id); + pgl.deleteProgram(res.id); } } @@ -945,7 +945,7 @@ public class PGraphicsOpenGL extends PGraphics { protected int createGLSLVertShaderObject(int context) { deleteFinalizedGLSLVertShaderObjects(); - int id = pgl.glCreateShader(PGL.GL_VERTEX_SHADER); + int id = pgl.createShader(PGL.VERTEX_SHADER); GLResource res = new GLResource(id, context); @@ -961,14 +961,14 @@ public class PGraphicsOpenGL extends PGraphics { protected void deleteGLSLVertShaderObject(int id, int context) { GLResource res = new GLResource(id, context); if (glslVertexShaders.containsKey(res)) { - pgl.glDeleteShader(res.id); + pgl.deleteShader(res.id); glslVertexShaders.remove(res); } } protected void deleteAllGLSLVertShaderObjects() { for (GLResource res : glslVertexShaders.keySet()) { - pgl.glDeleteShader(res.id); + pgl.deleteShader(res.id); } glslVertexShaders.clear(); } @@ -987,7 +987,7 @@ public class PGraphicsOpenGL extends PGraphics { for (GLResource res : glslVertexShaders.keySet()) { if (glslVertexShaders.get(res)) { finalized.add(res); - pgl.glDeleteShader(res.id); + pgl.deleteShader(res.id); } } @@ -1008,7 +1008,7 @@ public class PGraphicsOpenGL extends PGraphics { protected int createGLSLFragShaderObject(int context) { deleteFinalizedGLSLFragShaderObjects(); - int id = pgl.glCreateShader(PGL.GL_FRAGMENT_SHADER); + int id = pgl.createShader(PGL.FRAGMENT_SHADER); GLResource res = new GLResource(id, context); @@ -1024,14 +1024,14 @@ public class PGraphicsOpenGL extends PGraphics { protected void deleteGLSLFragShaderObject(int id, int context) { GLResource res = new GLResource(id, context); if (glslFragmentShaders.containsKey(res)) { - pgl.glDeleteShader(res.id); + pgl.deleteShader(res.id); glslFragmentShaders.remove(res); } } protected void deleteAllGLSLFragShaderObjects() { for (GLResource res : glslFragmentShaders.keySet()) { - pgl.glDeleteShader(res.id); + pgl.deleteShader(res.id); } glslFragmentShaders.clear(); } @@ -1050,7 +1050,7 @@ public class PGraphicsOpenGL extends PGraphics { for (GLResource res : glslFragmentShaders.keySet()) { if (glslFragmentShaders.get(res)) { finalized.add(res); - pgl.glDeleteShader(res.id); + pgl.deleteShader(res.id); } } @@ -1124,44 +1124,44 @@ public class PGraphicsOpenGL extends PGraphics { int sizex = INIT_INDEX_BUFFER_SIZE * PGL.SIZEOF_INDEX; glPolyVertex = createVertexBufferObject(polyBuffersContext.code()); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPolyVertex); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, 3 * sizef, null, PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyVertex); + pgl.bufferData(PGL.ARRAY_BUFFER, 3 * sizef, null, PGL.STATIC_DRAW); glPolyColor = createVertexBufferObject(polyBuffersContext.code()); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPolyColor); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, sizei, null, PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyColor); + pgl.bufferData(PGL.ARRAY_BUFFER, sizei, null, PGL.STATIC_DRAW); glPolyNormal = createVertexBufferObject(polyBuffersContext.code()); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPolyNormal); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, 3 * sizef, null, PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyNormal); + pgl.bufferData(PGL.ARRAY_BUFFER, 3 * sizef, null, PGL.STATIC_DRAW); glPolyTexcoord = createVertexBufferObject(polyBuffersContext.code()); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPolyTexcoord); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, 2 * sizef, null, PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyTexcoord); + pgl.bufferData(PGL.ARRAY_BUFFER, 2 * sizef, null, PGL.STATIC_DRAW); glPolyAmbient = pgPrimary.createVertexBufferObject(polyBuffersContext.code()); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPolyAmbient); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, sizei, null, PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyAmbient); + pgl.bufferData(PGL.ARRAY_BUFFER, sizei, null, PGL.STATIC_DRAW); glPolySpecular = pgPrimary.createVertexBufferObject(polyBuffersContext.code()); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPolySpecular); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, sizei, null, PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolySpecular); + pgl.bufferData(PGL.ARRAY_BUFFER, sizei, null, PGL.STATIC_DRAW); glPolyEmissive = pgPrimary.createVertexBufferObject(polyBuffersContext.code()); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPolyEmissive); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, sizei, null, PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyEmissive); + pgl.bufferData(PGL.ARRAY_BUFFER, sizei, null, PGL.STATIC_DRAW); glPolyShininess = pgPrimary.createVertexBufferObject(polyBuffersContext.code()); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPolyShininess); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, sizef, null, PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyShininess); + pgl.bufferData(PGL.ARRAY_BUFFER, sizef, null, PGL.STATIC_DRAW); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ARRAY_BUFFER, 0); glPolyIndex = createVertexBufferObject(polyBuffersContext.code()); - pgl.glBindBuffer(PGL.GL_ELEMENT_ARRAY_BUFFER, glPolyIndex); - pgl.glBufferData(PGL.GL_ELEMENT_ARRAY_BUFFER, sizex, null, PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, glPolyIndex); + pgl.bufferData(PGL.ELEMENT_ARRAY_BUFFER, sizex, null, PGL.STATIC_DRAW); - pgl.glBindBuffer(PGL.GL_ELEMENT_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, 0); polyBuffersCreated = true; } @@ -1175,44 +1175,44 @@ public class PGraphicsOpenGL extends PGraphics { int sizef = size * PGL.SIZEOF_FLOAT; int sizei = size * PGL.SIZEOF_INT; - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPolyVertex); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, 4 * sizef, FloatBuffer.wrap(tessGeo.polyVertices, 0, 4 * size), PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyVertex); + pgl.bufferData(PGL.ARRAY_BUFFER, 4 * sizef, FloatBuffer.wrap(tessGeo.polyVertices, 0, 4 * size), PGL.STATIC_DRAW); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPolyColor); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, sizei, IntBuffer.wrap(tessGeo.polyColors, 0, size), PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyColor); + pgl.bufferData(PGL.ARRAY_BUFFER, sizei, IntBuffer.wrap(tessGeo.polyColors, 0, size), PGL.STATIC_DRAW); if (lit) { - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPolyNormal); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, 3 * sizef, FloatBuffer.wrap(tessGeo.polyNormals, 0, 3 * size), PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyNormal); + pgl.bufferData(PGL.ARRAY_BUFFER, 3 * sizef, FloatBuffer.wrap(tessGeo.polyNormals, 0, 3 * size), PGL.STATIC_DRAW); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPolyAmbient); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, sizei, IntBuffer.wrap(tessGeo.polyAmbient, 0, size), PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyAmbient); + pgl.bufferData(PGL.ARRAY_BUFFER, sizei, IntBuffer.wrap(tessGeo.polyAmbient, 0, size), PGL.STATIC_DRAW); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPolySpecular); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, sizei, IntBuffer.wrap(tessGeo.polySpecular, 0, size), PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolySpecular); + pgl.bufferData(PGL.ARRAY_BUFFER, sizei, IntBuffer.wrap(tessGeo.polySpecular, 0, size), PGL.STATIC_DRAW); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPolyEmissive); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, sizei, IntBuffer.wrap(tessGeo.polyEmissive, 0, size), PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyEmissive); + pgl.bufferData(PGL.ARRAY_BUFFER, sizei, IntBuffer.wrap(tessGeo.polyEmissive, 0, size), PGL.STATIC_DRAW); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPolyShininess); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, sizef, FloatBuffer.wrap(tessGeo.polyShininess, 0, size), PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyShininess); + pgl.bufferData(PGL.ARRAY_BUFFER, sizef, FloatBuffer.wrap(tessGeo.polyShininess, 0, size), PGL.STATIC_DRAW); } if (tex) { - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPolyTexcoord); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, 2 * sizef, FloatBuffer.wrap(tessGeo.polyTexcoords, 0, 2 * size), PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyTexcoord); + pgl.bufferData(PGL.ARRAY_BUFFER, 2 * sizef, FloatBuffer.wrap(tessGeo.polyTexcoords, 0, 2 * size), PGL.STATIC_DRAW); } - pgl.glBindBuffer(PGL.GL_ELEMENT_ARRAY_BUFFER, glPolyIndex); - pgl.glBufferData(PGL.GL_ELEMENT_ARRAY_BUFFER, tessGeo.polyIndexCount * PGL.SIZEOF_INDEX, - ShortBuffer.wrap(tessGeo.polyIndices, 0, tessGeo.polyIndexCount), PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, glPolyIndex); + pgl.bufferData(PGL.ELEMENT_ARRAY_BUFFER, tessGeo.polyIndexCount * PGL.SIZEOF_INDEX, + ShortBuffer.wrap(tessGeo.polyIndices, 0, tessGeo.polyIndexCount), PGL.STATIC_DRAW); } protected void unbindPolyBuffers() { - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, 0); - pgl.glBindBuffer(PGL.GL_ELEMENT_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, 0); } @@ -1265,24 +1265,24 @@ public class PGraphicsOpenGL extends PGraphics { glLineVertex = createVertexBufferObject(lineBuffersContext.code()); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glLineVertex); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, 3 * sizef, null, PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glLineVertex); + pgl.bufferData(PGL.ARRAY_BUFFER, 3 * sizef, null, PGL.STATIC_DRAW); glLineColor = createVertexBufferObject(lineBuffersContext.code()); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glLineColor); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, sizei, null, PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glLineColor); + pgl.bufferData(PGL.ARRAY_BUFFER, sizei, null, PGL.STATIC_DRAW); glLineAttrib = createVertexBufferObject(lineBuffersContext.code()); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glLineAttrib); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, 4 * sizef, null, PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glLineAttrib); + pgl.bufferData(PGL.ARRAY_BUFFER, 4 * sizef, null, PGL.STATIC_DRAW); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ARRAY_BUFFER, 0); glLineIndex = createVertexBufferObject(lineBuffersContext.code()); - pgl.glBindBuffer(PGL.GL_ELEMENT_ARRAY_BUFFER, glLineIndex); - pgl.glBufferData(PGL.GL_ELEMENT_ARRAY_BUFFER, sizex, null, PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, glLineIndex); + pgl.bufferData(PGL.ELEMENT_ARRAY_BUFFER, sizex, null, PGL.STATIC_DRAW); - pgl.glBindBuffer(PGL.GL_ELEMENT_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, 0); lineBuffersCreated = true; } @@ -1296,24 +1296,24 @@ public class PGraphicsOpenGL extends PGraphics { int sizef = size * PGL.SIZEOF_FLOAT; int sizei = size * PGL.SIZEOF_INT; - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glLineVertex); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, 4 * sizef, FloatBuffer.wrap(tessGeo.lineVertices, 0, 4 * size), PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glLineVertex); + pgl.bufferData(PGL.ARRAY_BUFFER, 4 * sizef, FloatBuffer.wrap(tessGeo.lineVertices, 0, 4 * size), PGL.STATIC_DRAW); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glLineColor); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, sizei, IntBuffer.wrap(tessGeo.lineColors, 0, size), PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glLineColor); + pgl.bufferData(PGL.ARRAY_BUFFER, sizei, IntBuffer.wrap(tessGeo.lineColors, 0, size), PGL.STATIC_DRAW); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glLineAttrib); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, 4 * sizef, FloatBuffer.wrap(tessGeo.lineAttribs, 0, 4 * size), PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glLineAttrib); + pgl.bufferData(PGL.ARRAY_BUFFER, 4 * sizef, FloatBuffer.wrap(tessGeo.lineAttribs, 0, 4 * size), PGL.STATIC_DRAW); - pgl.glBindBuffer(PGL.GL_ELEMENT_ARRAY_BUFFER, glLineIndex); - pgl.glBufferData(PGL.GL_ELEMENT_ARRAY_BUFFER, tessGeo.lineIndexCount * PGL.SIZEOF_INDEX, - ShortBuffer.wrap(tessGeo.lineIndices, 0, tessGeo.lineIndexCount), PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, glLineIndex); + pgl.bufferData(PGL.ELEMENT_ARRAY_BUFFER, tessGeo.lineIndexCount * PGL.SIZEOF_INDEX, + ShortBuffer.wrap(tessGeo.lineIndices, 0, tessGeo.lineIndexCount), PGL.STATIC_DRAW); } protected void unbindLineBuffers() { - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, 0); - pgl.glBindBuffer(PGL.GL_ELEMENT_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, 0); } @@ -1350,24 +1350,24 @@ public class PGraphicsOpenGL extends PGraphics { int sizex = INIT_INDEX_BUFFER_SIZE * PGL.SIZEOF_INDEX; glPointVertex = createVertexBufferObject(pointBuffersContext.code()); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPointVertex); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, 3 * sizef, null, PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPointVertex); + pgl.bufferData(PGL.ARRAY_BUFFER, 3 * sizef, null, PGL.STATIC_DRAW); glPointColor = createVertexBufferObject(pointBuffersContext.code()); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPointColor); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, sizei, null, PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPointColor); + pgl.bufferData(PGL.ARRAY_BUFFER, sizei, null, PGL.STATIC_DRAW); glPointAttrib = createVertexBufferObject(pointBuffersContext.code()); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPointAttrib); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, 2 * sizef, null, PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPointAttrib); + pgl.bufferData(PGL.ARRAY_BUFFER, 2 * sizef, null, PGL.STATIC_DRAW); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ARRAY_BUFFER, 0); glPointIndex = createVertexBufferObject(pointBuffersContext.code()); - pgl.glBindBuffer(PGL.GL_ELEMENT_ARRAY_BUFFER, glPointIndex); - pgl.glBufferData(PGL.GL_ELEMENT_ARRAY_BUFFER, sizex, null, PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, glPointIndex); + pgl.bufferData(PGL.ELEMENT_ARRAY_BUFFER, sizex, null, PGL.STATIC_DRAW); - pgl.glBindBuffer(PGL.GL_ELEMENT_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, 0); pointBuffersCreated = true; } @@ -1381,24 +1381,24 @@ public class PGraphicsOpenGL extends PGraphics { int sizef = size * PGL.SIZEOF_FLOAT; int sizei = size * PGL.SIZEOF_INT; - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPointVertex); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, 4 * sizef, FloatBuffer.wrap(tessGeo.pointVertices, 0, 4 * size), PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPointVertex); + pgl.bufferData(PGL.ARRAY_BUFFER, 4 * sizef, FloatBuffer.wrap(tessGeo.pointVertices, 0, 4 * size), PGL.STATIC_DRAW); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPointColor); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, sizei, IntBuffer.wrap(tessGeo.pointColors, 0, size), PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPointColor); + pgl.bufferData(PGL.ARRAY_BUFFER, sizei, IntBuffer.wrap(tessGeo.pointColors, 0, size), PGL.STATIC_DRAW); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPointAttrib); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, 2 * sizef, FloatBuffer.wrap(tessGeo.pointAttribs, 0, 2 * size), PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPointAttrib); + pgl.bufferData(PGL.ARRAY_BUFFER, 2 * sizef, FloatBuffer.wrap(tessGeo.pointAttribs, 0, 2 * size), PGL.STATIC_DRAW); - pgl.glBindBuffer(PGL.GL_ELEMENT_ARRAY_BUFFER, glPointIndex); - pgl.glBufferData(PGL.GL_ELEMENT_ARRAY_BUFFER, tessGeo.pointIndexCount * PGL.SIZEOF_INDEX, - ShortBuffer.wrap(tessGeo.pointIndices, 0, tessGeo.pointIndexCount), PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, glPointIndex); + pgl.bufferData(PGL.ELEMENT_ARRAY_BUFFER, tessGeo.pointIndexCount * PGL.SIZEOF_INDEX, + ShortBuffer.wrap(tessGeo.pointIndices, 0, tessGeo.pointIndexCount), PGL.STATIC_DRAW); } protected void unbindPointBuffers() { - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, 0); - pgl.glBindBuffer(PGL.GL_ELEMENT_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, 0); } @@ -1471,7 +1471,7 @@ public class PGraphicsOpenGL extends PGraphics { if (primarySurface) { pgl.updatePrimary(); if (pgl.primaryIsDoubleBuffered()) { - pgl.glDrawBuffer(PGL.GL_BACK); + pgl.drawBuffer(PGL.BACK); } } else { if (!pgl.initialized) { @@ -1492,7 +1492,7 @@ public class PGraphicsOpenGL extends PGraphics { setFramebuffer(offscreenFramebuffer); } pgl.updateOffscreen(pgPrimary.pgl); - pgl.glDrawBuffer(PGL.GL_COLOR_ATTACHMENT0); + pgl.drawBuffer(PGL.COLOR_ATTACHMENT0); } // We are ready to go! @@ -1516,12 +1516,12 @@ public class PGraphicsOpenGL extends PGraphics { // this is necessary for 3D drawing if (hints[DISABLE_DEPTH_TEST]) { - pgl.glDisable(PGL.GL_DEPTH_TEST); + pgl.disable(PGL.DEPTH_TEST); } else { - pgl.glEnable(PGL.GL_DEPTH_TEST); + pgl.enable(PGL.DEPTH_TEST); } // use <= since that's what processing.core does - pgl.glDepthFunc(PGL.GL_LEQUAL); + pgl.depthFunc(PGL.LEQUAL); if (hints[ENABLE_ACCURATE_2D]) { flushMode = FLUSH_CONTINUOUSLY; @@ -1531,23 +1531,23 @@ public class PGraphicsOpenGL extends PGraphics { if (primarySurface) { int[] temp = new int[1]; - pgl.glGetIntegerv(PGL.GL_SAMPLES, temp, 0); + pgl.getIntegerv(PGL.SAMPLES, temp, 0); if (quality != temp[0] && 1 < temp[0] && 1 < quality) { quality = temp[0]; } } if (quality < 2) { - pgl.glDisable(PGL.GL_MULTISAMPLE); + pgl.disable(PGL.MULTISAMPLE); } else { - pgl.glEnable(PGL.GL_MULTISAMPLE); + pgl.enable(PGL.MULTISAMPLE); } - pgl.glDisable(PGL.GL_POINT_SMOOTH); - pgl.glDisable(PGL.GL_LINE_SMOOTH); - pgl.glDisable(PGL.GL_POLYGON_SMOOTH); + pgl.disable(PGL.POINT_SMOOTH); + pgl.disable(PGL.LINE_SMOOTH); + pgl.disable(PGL.POLYGON_SMOOTH); // setup opengl viewport. viewport[0] = 0; viewport[1] = 0; viewport[2] = width; viewport[3] = height; - pgl.glViewport(viewport[0], viewport[1], viewport[2], viewport[3]); + pgl.viewport(viewport[0], viewport[1], viewport[2], viewport[3]); if (resized) { // To avoid having garbage in the screen after a resize, // in the case background is not called in draw(). @@ -1590,20 +1590,20 @@ public class PGraphicsOpenGL extends PGraphics { // Because y is flipped, the vertices that should be specified by // the user in CCW order to define a front-facing facet, end up being // CW. - pgl.glFrontFace(PGL.GL_CW); - pgl.glDisable(PGL.GL_CULL_FACE); + pgl.frontFace(PGL.CW); + pgl.disable(PGL.CULL_FACE); // Processing uses only one texture unit. - pgl.glActiveTexture(PGL.GL_TEXTURE0); + pgl.activeTexture(PGL.TEXTURE0); // The current normal vector is set to be parallel to the Z axis. normalX = normalY = normalZ = 0; // Clear depth and stencil buffers. - pgl.glDepthMask(true); - pgl.glClearDepth(1); - pgl.glClearStencil(0); - pgl.glClear(PGL.GL_DEPTH_BUFFER_BIT | PGL.GL_STENCIL_BUFFER_BIT); + pgl.depthMask(true); + pgl.clearDepth(1); + pgl.clearStencil(0); + pgl.clear(PGL.DEPTH_BUFFER_BIT | PGL.STENCIL_BUFFER_BIT); if (primarySurface) { pgl.beginOnscreenDraw(clearColorBuffer); @@ -1615,10 +1615,10 @@ public class PGraphicsOpenGL extends PGraphics { // Restoring the clipping configuration of the offscreen surface. if (clip) { - pgl.glEnable(PGL.GL_SCISSOR_TEST); - pgl.glScissor(clipRect[0], clipRect[1], clipRect[2], clipRect[3]); + pgl.enable(PGL.SCISSOR_TEST); + pgl.scissor(clipRect[0], clipRect[1], clipRect[2], clipRect[3]); } else { - pgl.glDisable(PGL.GL_SCISSOR_TEST); + pgl.disable(PGL.SCISSOR_TEST); } } @@ -1632,9 +1632,9 @@ public class PGraphicsOpenGL extends PGraphics { } if (hints[DISABLE_DEPTH_MASK]) { - pgl.glDepthMask(false); + pgl.depthMask(false); } else { - pgl.glDepthMask(true); + pgl.depthMask(true); } pixelsOp = OP_NONE; @@ -1674,7 +1674,7 @@ public class PGraphicsOpenGL extends PGraphics { restoreSurface = true; } - pgl.glFlush(); + pgl.flush(); } else { if (offscreenMultisample) { offscreenFramebufferMultisample.copy(offscreenFramebuffer); @@ -1686,10 +1686,10 @@ public class PGraphicsOpenGL extends PGraphics { pushFramebuffer(); setFramebuffer(offscreenFramebuffer); } - pgl.glColorMask(false, false, false, true); - pgl.glClearColor(0, 0, 0, 1); - pgl.glClear(PGL.GL_COLOR_BUFFER_BIT); - pgl.glColorMask(true, true, true, true); + pgl.colorMask(false, false, false, true); + pgl.clearColor(0, 0, 0, 1); + pgl.clear(PGL.COLOR_BUFFER_BIT); + pgl.colorMask(true, true, true, true); if (offscreenMultisample) { popFramebuffer(); } @@ -1732,13 +1732,13 @@ public class PGraphicsOpenGL extends PGraphics { } - public PGL beginGL() { + public PGL beginPGL() { flush(); return pgl; } - public void endGL() { + public void endPGL() { restoreGL(); } @@ -1752,42 +1752,42 @@ public class PGraphicsOpenGL extends PGraphics { blendMode(blendMode); if (hints[DISABLE_DEPTH_TEST]) { - pgl.glDisable(PGL.GL_DEPTH_TEST); + pgl.disable(PGL.DEPTH_TEST); } else { - pgl.glEnable(PGL.GL_DEPTH_TEST); + pgl.enable(PGL.DEPTH_TEST); } - pgl.glDepthFunc(PGL.GL_LEQUAL); + pgl.depthFunc(PGL.LEQUAL); if (quality < 2) { - pgl.glDisable(PGL.GL_MULTISAMPLE); + pgl.disable(PGL.MULTISAMPLE); } else { - pgl.glEnable(PGL.GL_MULTISAMPLE); - pgl.glDisable(PGL.GL_POINT_SMOOTH); - pgl.glDisable(PGL.GL_LINE_SMOOTH); - pgl.glDisable(PGL.GL_POLYGON_SMOOTH); + pgl.enable(PGL.MULTISAMPLE); + pgl.disable(PGL.POINT_SMOOTH); + pgl.disable(PGL.LINE_SMOOTH); + pgl.disable(PGL.POLYGON_SMOOTH); } - pgl.glViewport(viewport[0], viewport[1], viewport[2], viewport[3]); + pgl.viewport(viewport[0], viewport[1], viewport[2], viewport[3]); if (clip) { - pgl.glEnable(PGL.GL_SCISSOR_TEST); - pgl.glScissor(clipRect[0], clipRect[1], clipRect[2], clipRect[3]); + pgl.enable(PGL.SCISSOR_TEST); + pgl.scissor(clipRect[0], clipRect[1], clipRect[2], clipRect[3]); } else { - pgl.glDisable(PGL.GL_SCISSOR_TEST); + pgl.disable(PGL.SCISSOR_TEST); } - pgl.glFrontFace(PGL.GL_CW); - pgl.glDisable(PGL.GL_CULL_FACE); + pgl.frontFace(PGL.CW); + pgl.disable(PGL.CULL_FACE); - pgl.glActiveTexture(PGL.GL_TEXTURE0); + pgl.activeTexture(PGL.TEXTURE0); if (hints[DISABLE_DEPTH_MASK]) { - pgl.glDepthMask(false); + pgl.depthMask(false); } else { - pgl.glDepthMask(true); + pgl.depthMask(true); } if (pgl.primaryIsDoubleBuffered()) { - pgl.glDrawBuffer(PGL.GL_BACK); + pgl.drawBuffer(PGL.BACK); } } @@ -1798,9 +1798,9 @@ public class PGraphicsOpenGL extends PGraphics { // We read or write from the back buffer, where all the // drawing in the current frame is taking place. if (op == OP_READ) { - pgl.glReadBuffer(PGL.GL_BACK); + pgl.readBuffer(PGL.BACK); } else { - pgl.glDrawBuffer(PGL.GL_BACK); + pgl.drawBuffer(PGL.BACK); } offscreenNotCurrent = false; } else if (pgl.primaryIsFboBacked()) { @@ -1808,11 +1808,11 @@ public class PGraphicsOpenGL extends PGraphics { // We read from the color FBO, but the multisample FBO is currently bound, so: offscreenNotCurrent = true; pgl.bindPrimaryColorFBO(); - pgl.glReadBuffer(PGL.GL_COLOR_ATTACHMENT0); + pgl.readBuffer(PGL.COLOR_ATTACHMENT0); } else { // We write directly to the multisample FBO. offscreenNotCurrent = false; - pgl.glDrawBuffer(PGL.GL_COLOR_ATTACHMENT0); + pgl.drawBuffer(PGL.COLOR_ATTACHMENT0); } } else { offscreenNotCurrent = false; @@ -1831,7 +1831,7 @@ public class PGraphicsOpenGL extends PGraphics { setFramebuffer(offscreenFramebuffer); pgl.updateOffscreen(pgPrimary.pgl); } - pgl.glReadBuffer(PGL.GL_COLOR_ATTACHMENT0); + pgl.readBuffer(PGL.COLOR_ATTACHMENT0); } else { // We can write directly to the color FBO, or to the multisample FBO // if multisampling is enabled. @@ -1849,7 +1849,7 @@ public class PGraphicsOpenGL extends PGraphics { } pgl.updateOffscreen(pgPrimary.pgl); } - pgl.glDrawBuffer(PGL.GL_COLOR_ATTACHMENT0); + pgl.drawBuffer(PGL.COLOR_ATTACHMENT0); } } pixelsOp = op; @@ -2029,16 +2029,16 @@ public class PGraphicsOpenGL extends PGraphics { if (which == DISABLE_DEPTH_TEST) { flush(); - pgl.glDisable(PGL.GL_DEPTH_TEST); + pgl.disable(PGL.DEPTH_TEST); } else if (which == ENABLE_DEPTH_TEST) { flush(); - pgl.glEnable(PGL.GL_DEPTH_TEST); + pgl.enable(PGL.DEPTH_TEST); } else if (which == DISABLE_DEPTH_MASK) { flush(); - pgl.glDepthMask(false); + pgl.depthMask(false); } else if (which == ENABLE_DEPTH_MASK) { flush(); - pgl.glDepthMask(true); + pgl.depthMask(true); } else if (which == DISABLE_ACCURATE_2D) { flush(); setFlushMode(FLUSH_WHEN_FULL); @@ -2284,14 +2284,14 @@ public class PGraphicsOpenGL extends PGraphics { protected void clipImpl(float x1, float y1, float x2, float y2) { flush(); - pgl.glEnable(PGL.GL_SCISSOR_TEST); + pgl.enable(PGL.SCISSOR_TEST); float h = y2 - y1; clipRect[0] = (int)x1; clipRect[1] = (int)(height - y1 - h); clipRect[2] = (int)(x2 - x1); clipRect[3] = (int)h; - pgl.glScissor(clipRect[0], clipRect[1], clipRect[2], clipRect[3]); + pgl.scissor(clipRect[0], clipRect[1], clipRect[2], clipRect[3]); clip = true; } @@ -2300,7 +2300,7 @@ public class PGraphicsOpenGL extends PGraphics { public void noClip() { if (clip) { flush(); - pgl.glDisable(PGL.GL_SCISSOR_TEST); + pgl.disable(PGL.SCISSOR_TEST); clip = false; } } @@ -2483,25 +2483,25 @@ public class PGraphicsOpenGL extends PGraphics { cache.indexOffset[n] + cache.indexCount[n] - ioffset; int voffset = cache.vertexOffset[n]; - shader.setVertexAttribute(glPolyVertex, 4, PGL.GL_FLOAT, 0, 4 * voffset * PGL.SIZEOF_FLOAT); - shader.setColorAttribute(glPolyColor, 4, PGL.GL_UNSIGNED_BYTE, 0, 4 * voffset * PGL.SIZEOF_BYTE); + shader.setVertexAttribute(glPolyVertex, 4, PGL.FLOAT, 0, 4 * voffset * PGL.SIZEOF_FLOAT); + shader.setColorAttribute(glPolyColor, 4, PGL.UNSIGNED_BYTE, 0, 4 * voffset * PGL.SIZEOF_BYTE); if (lights) { - shader.setNormalAttribute(glPolyNormal, 3, PGL.GL_FLOAT, 0, 3 * voffset * PGL.SIZEOF_FLOAT); - shader.setAmbientAttribute(glPolyAmbient, 4, PGL.GL_UNSIGNED_BYTE, 0, 4 * voffset * PGL.SIZEOF_BYTE); - shader.setSpecularAttribute(glPolySpecular, 4, PGL.GL_UNSIGNED_BYTE, 0, 4 * voffset * PGL.SIZEOF_BYTE); - shader.setEmissiveAttribute(glPolyEmissive, 4, PGL.GL_UNSIGNED_BYTE, 0, 4 * voffset * PGL.SIZEOF_BYTE); - shader.setShininessAttribute(glPolyShininess, 1, PGL.GL_FLOAT, 0, voffset * PGL.SIZEOF_FLOAT); + shader.setNormalAttribute(glPolyNormal, 3, PGL.FLOAT, 0, 3 * voffset * PGL.SIZEOF_FLOAT); + shader.setAmbientAttribute(glPolyAmbient, 4, PGL.UNSIGNED_BYTE, 0, 4 * voffset * PGL.SIZEOF_BYTE); + shader.setSpecularAttribute(glPolySpecular, 4, PGL.UNSIGNED_BYTE, 0, 4 * voffset * PGL.SIZEOF_BYTE); + shader.setEmissiveAttribute(glPolyEmissive, 4, PGL.UNSIGNED_BYTE, 0, 4 * voffset * PGL.SIZEOF_BYTE); + shader.setShininessAttribute(glPolyShininess, 1, PGL.FLOAT, 0, voffset * PGL.SIZEOF_FLOAT); } if (tex != null) { - shader.setTexcoordAttribute(glPolyTexcoord, 2, PGL.GL_FLOAT, 0, 2 * voffset * PGL.SIZEOF_FLOAT); + shader.setTexcoordAttribute(glPolyTexcoord, 2, PGL.FLOAT, 0, 2 * voffset * PGL.SIZEOF_FLOAT); shader.setTexture(tex); } - pgl.glBindBuffer(PGL.GL_ELEMENT_ARRAY_BUFFER, glPolyIndex); - pgl.glDrawElements(PGL.GL_TRIANGLES, icount, PGL.INDEX_TYPE, ioffset * PGL.SIZEOF_INDEX); - pgl.glBindBuffer(PGL.GL_ELEMENT_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, glPolyIndex); + pgl.drawElements(PGL.TRIANGLES, icount, PGL.INDEX_TYPE, ioffset * PGL.SIZEOF_INDEX); + pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, 0); } shader.unbind(); @@ -2621,13 +2621,13 @@ public class PGraphicsOpenGL extends PGraphics { int icount = cache.indexCount[n]; int voffset = cache.vertexOffset[n]; - shader.setVertexAttribute(glLineVertex, 4, PGL.GL_FLOAT, 0, 4 * voffset * PGL.SIZEOF_FLOAT); - shader.setColorAttribute(glLineColor, 4, PGL.GL_UNSIGNED_BYTE, 0, 4 * voffset * PGL.SIZEOF_BYTE); - shader.setLineAttribute(glLineAttrib, 4, PGL.GL_FLOAT, 0, 4 * voffset * PGL.SIZEOF_FLOAT); + shader.setVertexAttribute(glLineVertex, 4, PGL.FLOAT, 0, 4 * voffset * PGL.SIZEOF_FLOAT); + shader.setColorAttribute(glLineColor, 4, PGL.UNSIGNED_BYTE, 0, 4 * voffset * PGL.SIZEOF_BYTE); + shader.setLineAttribute(glLineAttrib, 4, PGL.FLOAT, 0, 4 * voffset * PGL.SIZEOF_FLOAT); - pgl.glBindBuffer(PGL.GL_ELEMENT_ARRAY_BUFFER, glLineIndex); - pgl.glDrawElements(PGL.GL_TRIANGLES, icount, PGL.INDEX_TYPE, ioffset * PGL.SIZEOF_INDEX); - pgl.glBindBuffer(PGL.GL_ELEMENT_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, glLineIndex); + pgl.drawElements(PGL.TRIANGLES, icount, PGL.INDEX_TYPE, ioffset * PGL.SIZEOF_INDEX); + pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, 0); } shader.unbind(); @@ -2719,13 +2719,13 @@ public class PGraphicsOpenGL extends PGraphics { int icount = cache.indexCount[n]; int voffset = cache.vertexOffset[n]; - shader.setVertexAttribute(glPointVertex, 4, PGL.GL_FLOAT, 0, 4 * voffset * PGL.SIZEOF_FLOAT); - shader.setColorAttribute(glPointColor, 4, PGL.GL_UNSIGNED_BYTE, 0, 4 * voffset * PGL.SIZEOF_BYTE); - shader.setPointAttribute(glPointAttrib, 2, PGL.GL_FLOAT, 0, 2 * voffset * PGL.SIZEOF_FLOAT); + shader.setVertexAttribute(glPointVertex, 4, PGL.FLOAT, 0, 4 * voffset * PGL.SIZEOF_FLOAT); + shader.setColorAttribute(glPointColor, 4, PGL.UNSIGNED_BYTE, 0, 4 * voffset * PGL.SIZEOF_BYTE); + shader.setPointAttribute(glPointAttrib, 2, PGL.FLOAT, 0, 2 * voffset * PGL.SIZEOF_FLOAT); - pgl.glBindBuffer(PGL.GL_ELEMENT_ARRAY_BUFFER, glPointIndex); - pgl.glDrawElements(PGL.GL_TRIANGLES, icount, PGL.INDEX_TYPE, ioffset * PGL.SIZEOF_INDEX); - pgl.glBindBuffer(PGL.GL_ELEMENT_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, glPointIndex); + pgl.drawElements(PGL.TRIANGLES, icount, PGL.INDEX_TYPE, ioffset * PGL.SIZEOF_INDEX); + pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, 0); } shader.unbind(); @@ -4840,17 +4840,17 @@ public class PGraphicsOpenGL extends PGraphics { protected void backgroundImpl() { flush(); - pgl.glDepthMask(true); - pgl.glClearDepth(1); - pgl.glClear(PGL.GL_DEPTH_BUFFER_BIT); + pgl.depthMask(true); + pgl.clearDepth(1); + pgl.clear(PGL.DEPTH_BUFFER_BIT); if (hints[DISABLE_DEPTH_MASK]) { - pgl.glDepthMask(false); + pgl.depthMask(false); } else { - pgl.glDepthMask(true); + pgl.depthMask(true); } - pgl.glClearColor(backgroundR, backgroundG, backgroundB, backgroundA); - pgl.glClear(PGL.GL_COLOR_BUFFER_BIT); + pgl.clearColor(backgroundR, backgroundG, backgroundB, backgroundA); + pgl.clear(PGL.COLOR_BUFFER_BIT); if (0 < parent.frameCount) { clearColorBuffer = true; } @@ -4903,9 +4903,9 @@ public class PGraphicsOpenGL extends PGraphics { */ public void report(String where) { if (!hints[DISABLE_OPENGL_ERROR_REPORT]) { - int err = pgl.glGetError(); + int err = pgl.getError(); if (err != 0) { - String errString = pgl.glErrorString(err); + String errString = pgl.errorString(err); String msg = "OpenGL error " + err + " at " + where + ": " + errString; PGraphics.showWarning(msg); } @@ -4988,7 +4988,7 @@ public class PGraphicsOpenGL extends PGraphics { protected void readPixels() { beginPixelsOp(OP_READ); pixelBuffer.rewind(); - pgl.glReadPixels(0, 0, width, height, PGL.GL_RGBA, PGL.GL_UNSIGNED_BYTE, pixelBuffer); + pgl.readPixels(0, 0, width, height, PGL.RGBA, PGL.UNSIGNED_BYTE, pixelBuffer); endPixelsOp(); PGL.nativeToJavaARGB(pixels, width, height); @@ -5096,7 +5096,7 @@ public class PGraphicsOpenGL extends PGraphics { } beginPixelsOp(OP_READ); - pgl.glReadPixels(0, 0, width, height, PGL.GL_RGBA, PGL.GL_UNSIGNED_BYTE, nativePixelBuffer); + pgl.readPixels(0, 0, width, height, PGL.RGBA, PGL.UNSIGNED_BYTE, nativePixelBuffer); endPixelsOp(); texture.setNative(nativePixels, 0, 0, width, height); @@ -5114,10 +5114,10 @@ public class PGraphicsOpenGL extends PGraphics { pushFramebuffer(); setFramebuffer(offscreenFramebuffer); } - pgl.glColorMask(false, false, false, true); - pgl.glClearColor(0, 0, 0, 1); - pgl.glClear(PGL.GL_COLOR_BUFFER_BIT); - pgl.glColorMask(true, true, true, true); + pgl.colorMask(false, false, false, true); + pgl.clearColor(0, 0, 0, 1); + pgl.clear(PGL.COLOR_BUFFER_BIT); + pgl.colorMask(true, true, true, true); if (offscreenMultisample) { popFramebuffer(); } @@ -5316,10 +5316,10 @@ public class PGraphicsOpenGL extends PGraphics { // Disable writing to the depth buffer, so that after applying the filter we can // still use the depth information to keep adding geometry to the scene. - pgl.glDepthMask(false); + pgl.depthMask(false); // Also disabling depth testing so the texture is drawn on top of everything that // has been drawn before. - pgl.glDisable(PGL.GL_DEPTH_TEST); + pgl.disable(PGL.DEPTH_TEST); PolyTexShader prevTexShader = polyTexShader; polyTexShader = (PolyTexShader) shader; @@ -5351,10 +5351,10 @@ public class PGraphicsOpenGL extends PGraphics { polyTexShader = prevTexShader; if (!hints[DISABLE_DEPTH_TEST]) { - pgl.glEnable(PGL.GL_DEPTH_TEST); + pgl.enable(PGL.DEPTH_TEST); } if (!hints[DISABLE_DEPTH_MASK]) { - pgl.glDepthMask(true); + pgl.depthMask(true); } } @@ -5421,67 +5421,67 @@ public class PGraphicsOpenGL extends PGraphics { flush(); blendMode = mode; - pgl.glEnable(PGL.GL_BLEND); + pgl.enable(PGL.BLEND); if (mode == REPLACE) { if (blendEqSupported) { - pgl.glBlendEquation(PGL.GL_FUNC_ADD); + pgl.blendEquation(PGL.FUNC_ADD); } - pgl.glBlendFunc(PGL.GL_ONE, PGL.GL_ZERO); + pgl.blendFunc(PGL.ONE, PGL.ZERO); } else if (mode == BLEND) { if (blendEqSupported) { - pgl.glBlendEquation(PGL.GL_FUNC_ADD); + pgl.blendEquation(PGL.FUNC_ADD); } - pgl.glBlendFunc(PGL.GL_SRC_ALPHA, PGL.GL_ONE_MINUS_SRC_ALPHA); + pgl.blendFunc(PGL.SRC_ALPHA, PGL.ONE_MINUS_SRC_ALPHA); } else if (mode == ADD) { if (blendEqSupported) { - pgl.glBlendEquation(PGL.GL_FUNC_ADD); + pgl.blendEquation(PGL.FUNC_ADD); } - pgl.glBlendFunc(PGL.GL_SRC_ALPHA, PGL.GL_ONE); + pgl.blendFunc(PGL.SRC_ALPHA, PGL.ONE); } else if (mode == SUBTRACT) { if (blendEqSupported) { - pgl.glBlendEquation(PGL.GL_FUNC_ADD); + pgl.blendEquation(PGL.FUNC_ADD); } - pgl.glBlendFunc(PGL.GL_ONE_MINUS_DST_COLOR, PGL.GL_ZERO); + pgl.blendFunc(PGL.ONE_MINUS_DST_COLOR, PGL.ZERO); } else if (mode == LIGHTEST) { if (blendEqSupported) { - pgl.glBlendEquation(PGL.GL_FUNC_MAX); + pgl.blendEquation(PGL.FUNC_MAX); } else { PGraphics.showWarning("This blend mode is not supported"); return; } - pgl.glBlendFunc(PGL.GL_SRC_ALPHA, PGL.GL_DST_ALPHA); + pgl.blendFunc(PGL.SRC_ALPHA, PGL.DST_ALPHA); } else if (mode == DARKEST) { if (blendEqSupported) { - pgl.glBlendEquation(PGL.GL_FUNC_MIN); + pgl.blendEquation(PGL.FUNC_MIN); } else { PGraphics.showWarning("This blend mode is not supported"); return; } - pgl.glBlendFunc(PGL.GL_SRC_ALPHA, PGL.GL_DST_ALPHA); + pgl.blendFunc(PGL.SRC_ALPHA, PGL.DST_ALPHA); } else if (mode == DIFFERENCE) { if (blendEqSupported) { - pgl.glBlendEquation(PGL.GL_FUNC_REVERSE_SUBTRACT); + pgl.blendEquation(PGL.FUNC_REVERSE_SUBTRACT); } else { PGraphics.showWarning("This blend mode is not supported"); return; } - pgl.glBlendFunc(PGL.GL_ONE, PGL.GL_ONE); + pgl.blendFunc(PGL.ONE, PGL.ONE); } else if (mode == EXCLUSION) { if (blendEqSupported) { - pgl.glBlendEquation(PGL.GL_FUNC_ADD); + pgl.blendEquation(PGL.FUNC_ADD); } - pgl.glBlendFunc(PGL.GL_ONE_MINUS_DST_COLOR, PGL.GL_ONE_MINUS_SRC_COLOR); + pgl.blendFunc(PGL.ONE_MINUS_DST_COLOR, PGL.ONE_MINUS_SRC_COLOR); } else if (mode == MULTIPLY) { if (blendEqSupported) { - pgl.glBlendEquation(PGL.GL_FUNC_ADD); + pgl.blendEquation(PGL.FUNC_ADD); } - pgl.glBlendFunc(PGL.GL_DST_COLOR, PGL.GL_SRC_COLOR); + pgl.blendFunc(PGL.DST_COLOR, PGL.SRC_COLOR); } else if (mode == SCREEN) { if (blendEqSupported) { - pgl.glBlendEquation(PGL.GL_FUNC_ADD); + pgl.blendEquation(PGL.FUNC_ADD); } - pgl.glBlendFunc(PGL.GL_ONE_MINUS_DST_COLOR, PGL.GL_ONE); + pgl.blendFunc(PGL.ONE_MINUS_DST_COLOR, PGL.ONE); } // HARD_LIGHT, SOFT_LIGHT, OVERLAY, DODGE, BURN modes cannot be implemented // in fixed-function pipeline because they require conditional blending and @@ -5492,11 +5492,11 @@ public class PGraphicsOpenGL extends PGraphics { protected void setDefaultBlend() { blendMode = BLEND; - pgl.glEnable(PGL.GL_BLEND); + pgl.enable(PGL.BLEND); if (blendEqSupported) { - pgl.glBlendEquation(PGL.GL_FUNC_ADD); + pgl.blendEquation(PGL.FUNC_ADD); } - pgl.glBlendFunc(PGL.GL_SRC_ALPHA, PGL.GL_ONE_MINUS_SRC_ALPHA); + pgl.blendFunc(PGL.SRC_ALPHA, PGL.ONE_MINUS_SRC_ALPHA); } @@ -5695,11 +5695,11 @@ public class PGraphicsOpenGL extends PGraphics { protected void getGLParameters() { - OPENGL_VENDOR = pgl.glGetString(PGL.GL_VENDOR); - OPENGL_RENDERER = pgl.glGetString(PGL.GL_RENDERER); - OPENGL_VERSION = pgl.glGetString(PGL.GL_VERSION); - OPENGL_EXTENSIONS = pgl.glGetString(PGL.GL_EXTENSIONS); - GLSL_VERSION = pgl.glGetString(PGL.GL_SHADING_LANGUAGE_VERSION); + OPENGL_VENDOR = pgl.getString(PGL.VENDOR); + OPENGL_RENDERER = pgl.getString(PGL.RENDERER); + OPENGL_VERSION = pgl.getString(PGL.VERSION); + OPENGL_EXTENSIONS = pgl.getString(PGL.EXTENSIONS); + GLSL_VERSION = pgl.getString(PGL.SHADING_LANGUAGE_VERSION); npotTexSupported = -1 < OPENGL_EXTENSIONS.indexOf("texture_non_power_of_two"); autoMipmapGenSupported = -1 < OPENGL_EXTENSIONS.indexOf("generate_mipmap"); @@ -5707,7 +5707,7 @@ public class PGraphicsOpenGL extends PGraphics { packedDepthStencilSupported = -1 < OPENGL_EXTENSIONS.indexOf("packed_depth_stencil"); try { - pgl.glBlendEquation(PGL.GL_FUNC_ADD); + pgl.blendEquation(PGL.FUNC_ADD); blendEqSupported = true; } catch (Exception e) { blendEqSupported = false; @@ -5715,22 +5715,22 @@ public class PGraphicsOpenGL extends PGraphics { int temp[] = new int[2]; - pgl.glGetIntegerv(PGL.GL_MAX_TEXTURE_SIZE, temp, 0); + pgl.getIntegerv(PGL.MAX_TEXTURE_SIZE, temp, 0); maxTextureSize = temp[0]; - pgl.glGetIntegerv(PGL.GL_MAX_SAMPLES, temp, 0); + pgl.getIntegerv(PGL.MAX_SAMPLES, temp, 0); maxSamples = temp[0]; - pgl.glGetIntegerv(PGL.GL_ALIASED_LINE_WIDTH_RANGE, temp, 0); + pgl.getIntegerv(PGL.ALIASED_LINE_WIDTH_RANGE, temp, 0); maxLineWidth = temp[1]; - pgl.glGetIntegerv(PGL.GL_ALIASED_POINT_SIZE_RANGE, temp, 0); + pgl.getIntegerv(PGL.ALIASED_POINT_SIZE_RANGE, temp, 0); maxPointSize = temp[1]; - pgl.glGetIntegerv(PGL.GL_DEPTH_BITS, temp, 0); + pgl.getIntegerv(PGL.DEPTH_BITS, temp, 0); depthBits = temp[0]; - pgl.glGetIntegerv(PGL.GL_STENCIL_BITS, temp, 0); + pgl.getIntegerv(PGL.STENCIL_BITS, temp, 0); stencilBits = temp[0]; glParamsRead = true; @@ -6064,8 +6064,8 @@ public class PGraphicsOpenGL extends PGraphics { public void bind() { super.bind(); - if (-1 < inVertexLoc) pgl.glEnableVertexAttribArray(inVertexLoc); - if (-1 < inColorLoc) pgl.glEnableVertexAttribArray(inColorLoc); + if (-1 < inVertexLoc) pgl.enableVertexAttribArray(inVertexLoc); + if (-1 < inColorLoc) pgl.enableVertexAttribArray(inColorLoc); if (pgCurrent != null) { if (-1 < projmodelviewMatrixLoc) { @@ -6086,10 +6086,10 @@ public class PGraphicsOpenGL extends PGraphics { } public void unbind() { - if (-1 < inVertexLoc) pgl.glDisableVertexAttribArray(inVertexLoc); - if (-1 < inColorLoc) pgl.glDisableVertexAttribArray(inColorLoc); + if (-1 < inVertexLoc) pgl.disableVertexAttribArray(inVertexLoc); + if (-1 < inColorLoc) pgl.disableVertexAttribArray(inColorLoc); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ARRAY_BUFFER, 0); super.unbind(); } @@ -6190,14 +6190,14 @@ public class PGraphicsOpenGL extends PGraphics { public void bind() { super.bind(); - if (-1 < inVertexLoc) pgl.glEnableVertexAttribArray(inVertexLoc); - if (-1 < inColorLoc) pgl.glEnableVertexAttribArray(inColorLoc); - if (-1 < inNormalLoc) pgl.glEnableVertexAttribArray(inNormalLoc); + if (-1 < inVertexLoc) pgl.enableVertexAttribArray(inVertexLoc); + if (-1 < inColorLoc) pgl.enableVertexAttribArray(inColorLoc); + if (-1 < inNormalLoc) pgl.enableVertexAttribArray(inNormalLoc); - if (-1 < inAmbientLoc) pgl.glEnableVertexAttribArray(inAmbientLoc); - if (-1 < inSpecularLoc) pgl.glEnableVertexAttribArray(inSpecularLoc); - if (-1 < inEmissiveLoc) pgl.glEnableVertexAttribArray(inEmissiveLoc); - if (-1 < inShineLoc) pgl.glEnableVertexAttribArray(inShineLoc); + if (-1 < inAmbientLoc) pgl.enableVertexAttribArray(inAmbientLoc); + if (-1 < inSpecularLoc) pgl.enableVertexAttribArray(inSpecularLoc); + if (-1 < inEmissiveLoc) pgl.enableVertexAttribArray(inEmissiveLoc); + if (-1 < inShineLoc) pgl.enableVertexAttribArray(inShineLoc); if (pgCurrent != null) { if (-1 < projmodelviewMatrixLoc) { @@ -6232,16 +6232,16 @@ public class PGraphicsOpenGL extends PGraphics { } public void unbind() { - if (-1 < inVertexLoc) pgl.glDisableVertexAttribArray(inVertexLoc); - if (-1 < inColorLoc) pgl.glDisableVertexAttribArray(inColorLoc); - if (-1 < inNormalLoc) pgl.glDisableVertexAttribArray(inNormalLoc); + if (-1 < inVertexLoc) pgl.disableVertexAttribArray(inVertexLoc); + if (-1 < inColorLoc) pgl.disableVertexAttribArray(inColorLoc); + if (-1 < inNormalLoc) pgl.disableVertexAttribArray(inNormalLoc); - if (-1 < inAmbientLoc) pgl.glDisableVertexAttribArray(inAmbientLoc); - if (-1 < inSpecularLoc) pgl.glDisableVertexAttribArray(inSpecularLoc); - if (-1 < inEmissiveLoc) pgl.glDisableVertexAttribArray(inEmissiveLoc); - if (-1 < inShineLoc) pgl.glDisableVertexAttribArray(inShineLoc); + if (-1 < inAmbientLoc) pgl.disableVertexAttribArray(inAmbientLoc); + if (-1 < inSpecularLoc) pgl.disableVertexAttribArray(inSpecularLoc); + if (-1 < inEmissiveLoc) pgl.disableVertexAttribArray(inEmissiveLoc); + if (-1 < inShineLoc) pgl.disableVertexAttribArray(inShineLoc); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ARRAY_BUFFER, 0); super.unbind(); } @@ -6329,11 +6329,11 @@ public class PGraphicsOpenGL extends PGraphics { super.bind(); - if (-1 < inTexcoordLoc) pgl.glEnableVertexAttribArray(inTexcoordLoc); + if (-1 < inTexcoordLoc) pgl.enableVertexAttribArray(inTexcoordLoc); } public void unbind() { - if (-1 < inTexcoordLoc) pgl.glDisableVertexAttribArray(inTexcoordLoc); + if (-1 < inTexcoordLoc) pgl.disableVertexAttribArray(inTexcoordLoc); super.unbind(); } @@ -6421,11 +6421,11 @@ public class PGraphicsOpenGL extends PGraphics { super.bind(); - if (-1 < inTexcoordLoc) pgl.glEnableVertexAttribArray(inTexcoordLoc); + if (-1 < inTexcoordLoc) pgl.enableVertexAttribArray(inTexcoordLoc); } public void unbind() { - if (-1 < inTexcoordLoc) pgl.glDisableVertexAttribArray(inTexcoordLoc); + if (-1 < inTexcoordLoc) pgl.disableVertexAttribArray(inTexcoordLoc); super.unbind(); } @@ -6488,9 +6488,9 @@ public class PGraphicsOpenGL extends PGraphics { public void bind() { super.bind(); - if (-1 < inVertexLoc) pgl.glEnableVertexAttribArray(inVertexLoc); - if (-1 < inColorLoc) pgl.glEnableVertexAttribArray(inColorLoc); - if (-1 < inAttribLoc) pgl.glEnableVertexAttribArray(inAttribLoc); + if (-1 < inVertexLoc) pgl.enableVertexAttribArray(inVertexLoc); + if (-1 < inColorLoc) pgl.enableVertexAttribArray(inColorLoc); + if (-1 < inAttribLoc) pgl.enableVertexAttribArray(inAttribLoc); if (pgCurrent != null) { if (-1 < projmodelviewMatrixLoc) { @@ -6533,11 +6533,11 @@ public class PGraphicsOpenGL extends PGraphics { } public void unbind() { - if (-1 < inVertexLoc) pgl.glDisableVertexAttribArray(inVertexLoc); - if (-1 < inColorLoc) pgl.glDisableVertexAttribArray(inColorLoc); - if (-1 < inAttribLoc) pgl.glDisableVertexAttribArray(inAttribLoc); + if (-1 < inVertexLoc) pgl.disableVertexAttribArray(inVertexLoc); + if (-1 < inColorLoc) pgl.disableVertexAttribArray(inColorLoc); + if (-1 < inAttribLoc) pgl.disableVertexAttribArray(inAttribLoc); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ARRAY_BUFFER, 0); super.unbind(); } @@ -6592,9 +6592,9 @@ public class PGraphicsOpenGL extends PGraphics { public void bind() { super.bind(); - if (-1 < inVertexLoc) pgl.glEnableVertexAttribArray(inVertexLoc); - if (-1 < inColorLoc) pgl.glEnableVertexAttribArray(inColorLoc); - if (-1 < inPointLoc) pgl.glEnableVertexAttribArray(inPointLoc); + if (-1 < inVertexLoc) pgl.enableVertexAttribArray(inVertexLoc); + if (-1 < inColorLoc) pgl.enableVertexAttribArray(inColorLoc); + if (-1 < inPointLoc) pgl.enableVertexAttribArray(inPointLoc); if (pgCurrent != null) { if (-1 < projmodelviewMatrixLoc) { @@ -6615,11 +6615,11 @@ public class PGraphicsOpenGL extends PGraphics { } public void unbind() { - if (-1 < inVertexLoc) pgl.glDisableVertexAttribArray(inVertexLoc); - if (-1 < inColorLoc) pgl.glDisableVertexAttribArray(inColorLoc); - if (-1 < inPointLoc) pgl.glDisableVertexAttribArray(inPointLoc); + if (-1 < inVertexLoc) pgl.disableVertexAttribArray(inVertexLoc); + if (-1 < inColorLoc) pgl.disableVertexAttribArray(inColorLoc); + if (-1 < inPointLoc) pgl.disableVertexAttribArray(inPointLoc); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ARRAY_BUFFER, 0); super.unbind(); } @@ -10708,10 +10708,10 @@ public class PGraphicsOpenGL extends PGraphics { if (solid) { // Using NONZERO winding rule for solid polygons. - gluTess.setWindingRule(PGL.GLU_TESS_WINDING_NONZERO); + gluTess.setWindingRule(PGL.TESS_WINDING_NONZERO); } else { // Using ODD winding rule to generate polygon with holes. - gluTess.setWindingRule(PGL.GLU_TESS_WINDING_ODD); + gluTess.setWindingRule(PGL.TESS_WINDING_ODD); } gluTess.beginContour(); @@ -10788,10 +10788,10 @@ public class PGraphicsOpenGL extends PGraphics { int rule = iter.getWindingRule(); switch(rule) { case LinePath.WIND_EVEN_ODD: - gluTess.setWindingRule(PGL.GLU_TESS_WINDING_ODD); + gluTess.setWindingRule(PGL.TESS_WINDING_ODD); break; case LinePath.WIND_NON_ZERO: - gluTess.setWindingRule(PGL.GLU_TESS_WINDING_NONZERO); + gluTess.setWindingRule(PGL.TESS_WINDING_NONZERO); break; } @@ -10876,13 +10876,13 @@ public class PGraphicsOpenGL extends PGraphics { vertCount = 0; switch (type) { - case PGL.GL_TRIANGLE_FAN: + case PGL.TRIANGLE_FAN: primitive = TRIANGLE_FAN; break; - case PGL.GL_TRIANGLE_STRIP: + case PGL.TRIANGLE_STRIP: primitive = TRIANGLE_STRIP; break; - case PGL.GL_TRIANGLES: + case PGL.TRIANGLES: primitive = TRIANGLES; break; } @@ -10992,7 +10992,7 @@ public class PGraphicsOpenGL extends PGraphics { } public void error(int errnum) { - String estring = pgl.gluErrorString(errnum); + String estring = pgl.tessError(errnum); PGraphics.showWarning("Tessellation Error: " + estring); } diff --git a/core/src/processing/opengl/PShader.java b/core/src/processing/opengl/PShader.java index 7bb85c5e2..5e7179eae 100644 --- a/core/src/processing/opengl/PShader.java +++ b/core/src/processing/opengl/PShader.java @@ -189,7 +189,7 @@ public class PShader { */ public void bind() { init(); - pgl.glUseProgram(glProgram); + pgl.useProgram(glProgram); bound = true; consumeUniforms(); bindTextures(); @@ -201,7 +201,7 @@ public class PShader { */ public void unbind() { unbindTextures(); - pgl.glUseProgram(0); + pgl.useProgram(0); bound = false; } @@ -345,7 +345,7 @@ public class PShader { */ protected int getAttributeLoc(String name) { init(); - return pgl.glGetAttribLocation(glProgram, name); + return pgl.getAttribLocation(glProgram, name); } @@ -357,69 +357,69 @@ public class PShader { */ protected int getUniformLoc(String name) { init(); - return pgl.glGetUniformLocation(glProgram, name); + return pgl.getUniformLocation(glProgram, name); } protected void setAttributeVBO(int loc, int vboId, int size, int type, boolean normalized, int stride, int offset) { if (-1 < loc) { - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, vboId); - pgl.glVertexAttribPointer(loc, size, type, normalized, stride, offset); + pgl.bindBuffer(PGL.ARRAY_BUFFER, vboId); + pgl.vertexAttribPointer(loc, size, type, normalized, stride, offset); } } protected void setUniformValue(int loc, int x) { if (-1 < loc) { - pgl.glUniform1i(loc, x); + pgl.uniform1i(loc, x); } } protected void setUniformValue(int loc, int x, int y) { if (-1 < loc) { - pgl.glUniform2i(loc, x, y); + pgl.uniform2i(loc, x, y); } } protected void setUniformValue(int loc, int x, int y, int z) { if (-1 < loc) { - pgl.glUniform3i(loc, x, y, z); + pgl.uniform3i(loc, x, y, z); } } protected void setUniformValue(int loc, int x, int y, int z, int w) { if (-1 < loc) { - pgl.glUniform4i(loc, x, y, z, w); + pgl.uniform4i(loc, x, y, z, w); } } protected void setUniformValue(int loc, float x) { if (-1 < loc) { - pgl.glUniform1f(loc, x); + pgl.uniform1f(loc, x); } } protected void setUniformValue(int loc, float x, float y) { if (-1 < loc) { - pgl.glUniform2f(loc, x, y); + pgl.uniform2f(loc, x, y); } } protected void setUniformValue(int loc, float x, float y, float z) { if (-1 < loc) { - pgl.glUniform3f(loc, x, y, z); + pgl.uniform3f(loc, x, y, z); } } protected void setUniformValue(int loc, float x, float y, float z, float w) { if (-1 < loc) { - pgl.glUniform4f(loc, x, y, z, w); + pgl.uniform4f(loc, x, y, z, w); } } @@ -427,13 +427,13 @@ public class PShader { protected void setUniformVector(int loc, int[] vec, int ncoords) { if (-1 < loc) { if (ncoords == 1) { - pgl.glUniform1iv(loc, vec.length, vec, 0); + pgl.uniform1iv(loc, vec.length, vec, 0); } else if (ncoords == 2) { - pgl.glUniform2iv(loc, vec.length / 2, vec, 0); + pgl.uniform2iv(loc, vec.length / 2, vec, 0); } else if (ncoords == 3) { - pgl.glUniform3iv(loc, vec.length / 3, vec, 0); + pgl.uniform3iv(loc, vec.length / 3, vec, 0); } else if (ncoords == 4) { - pgl.glUniform3iv(loc, vec.length / 4, vec, 0); + pgl.uniform3iv(loc, vec.length / 4, vec, 0); } } } @@ -442,13 +442,13 @@ public class PShader { protected void setUniformVector(int loc, float[] vec, int ncoords) { if (-1 < loc) { if (ncoords == 1) { - pgl.glUniform1fv(loc, vec.length, vec, 0); + pgl.uniform1fv(loc, vec.length, vec, 0); } else if (ncoords == 2) { - pgl.glUniform2fv(loc, vec.length / 2, vec, 0); + pgl.uniform2fv(loc, vec.length / 2, vec, 0); } else if (ncoords == 3) { - pgl.glUniform3fv(loc, vec.length / 3, vec, 0); + pgl.uniform3fv(loc, vec.length / 3, vec, 0); } else if (ncoords == 4) { - pgl.glUniform4fv(loc, vec.length / 4, vec, 0); + pgl.uniform4fv(loc, vec.length / 4, vec, 0); } } } @@ -457,11 +457,11 @@ public class PShader { protected void setUniformMatrix(int loc, float[] mat) { if (-1 < loc) { if (mat.length == 4) { - pgl.glUniformMatrix2fv(loc, 1, false, mat, 0); + pgl.uniformMatrix2fv(loc, 1, false, mat, 0); } else if (mat.length == 9) { - pgl.glUniformMatrix3fv(loc, 1, false, mat, 0); + pgl.uniformMatrix3fv(loc, 1, false, mat, 0); } else if (mat.length == 16) { - pgl.glUniformMatrix4fv(loc, 1, false, mat, 0); + pgl.uniformMatrix4fv(loc, 1, false, mat, 0); } } } @@ -521,65 +521,65 @@ public class PShader { UniformValue val = uniformValues.get(loc); if (val.type == UniformValue.INT1) { int[] v = ((int[])val.value); - pgl.glUniform1i(loc, v[0]); + pgl.uniform1i(loc, v[0]); } else if (val.type == UniformValue.INT2) { int[] v = ((int[])val.value); - pgl.glUniform2i(loc, v[0], v[1]); + pgl.uniform2i(loc, v[0], v[1]); } else if (val.type == UniformValue.INT3) { int[] v = ((int[])val.value); - pgl.glUniform3i(loc, v[0], v[1], v[2]); + pgl.uniform3i(loc, v[0], v[1], v[2]); } else if (val.type == UniformValue.INT4) { int[] v = ((int[])val.value); - pgl.glUniform4i(loc, v[0], v[1], v[2], v[4]); + pgl.uniform4i(loc, v[0], v[1], v[2], v[4]); } else if (val.type == UniformValue.FLOAT1) { float[] v = ((float[])val.value); - pgl.glUniform1f(loc, v[0]); + pgl.uniform1f(loc, v[0]); } else if (val.type == UniformValue.FLOAT2) { float[] v = ((float[])val.value); - pgl.glUniform2f(loc, v[0], v[1]); + pgl.uniform2f(loc, v[0], v[1]); } else if (val.type == UniformValue.FLOAT3) { float[] v = ((float[])val.value); - pgl.glUniform3f(loc, v[0], v[1], v[2]); + pgl.uniform3f(loc, v[0], v[1], v[2]); } else if (val.type == UniformValue.FLOAT4) { float[] v = ((float[])val.value); - pgl.glUniform4f(loc, v[0], v[1], v[2], v[3]); + pgl.uniform4f(loc, v[0], v[1], v[2], v[3]); } else if (val.type == UniformValue.INT1VEC) { int[] v = ((int[])val.value); - pgl.glUniform1iv(loc, v.length, v, 0); + pgl.uniform1iv(loc, v.length, v, 0); } else if (val.type == UniformValue.INT2VEC) { int[] v = ((int[])val.value); - pgl.glUniform2iv(loc, v.length / 2, v, 0); + pgl.uniform2iv(loc, v.length / 2, v, 0); } else if (val.type == UniformValue.INT3VEC) { int[] v = ((int[])val.value); - pgl.glUniform3iv(loc, v.length / 3, v, 0); + pgl.uniform3iv(loc, v.length / 3, v, 0); } else if (val.type == UniformValue.INT4VEC) { int[] v = ((int[])val.value); - pgl.glUniform4iv(loc, v.length / 4, v, 0); + pgl.uniform4iv(loc, v.length / 4, v, 0); } else if (val.type == UniformValue.FLOAT1VEC) { float[] v = ((float[])val.value); - pgl.glUniform1fv(loc, v.length, v, 0); + pgl.uniform1fv(loc, v.length, v, 0); } else if (val.type == UniformValue.FLOAT2VEC) { float[] v = ((float[])val.value); - pgl.glUniform2fv(loc, v.length / 2, v, 0); + pgl.uniform2fv(loc, v.length / 2, v, 0); } else if (val.type == UniformValue.FLOAT3VEC) { float[] v = ((float[])val.value); - pgl.glUniform3fv(loc, v.length / 3, v, 0); + pgl.uniform3fv(loc, v.length / 3, v, 0); } else if (val.type == UniformValue.FLOAT4VEC) { float[] v = ((float[])val.value); - pgl.glUniform4fv(loc, v.length / 4, v, 0); + pgl.uniform4fv(loc, v.length / 4, v, 0); } else if (val.type == UniformValue.MAT2) { float[] v = ((float[])val.value); - pgl.glUniformMatrix2fv(loc, 1, false, v, 0); + pgl.uniformMatrix2fv(loc, 1, false, v, 0); } else if (val.type == UniformValue.MAT3) { float[] v = ((float[])val.value); - pgl.glUniformMatrix3fv(loc, 1, false, v, 0); + pgl.uniformMatrix3fv(loc, 1, false, v, 0); } else if (val.type == UniformValue.MAT4) { float[] v = ((float[])val.value); - pgl.glUniformMatrix4fv(loc, 1, false, v, 0); + pgl.uniformMatrix4fv(loc, 1, false, v, 0); } else if (val.type == UniformValue.SAMPLER2D) { PImage img = (PImage)val.value; Texture tex = pgMain.getTexture(img); - pgl.glUniform1i(loc, texUnit); + pgl.uniform1i(loc, texUnit); if (textures == null) { textures = new HashMap(); } @@ -596,7 +596,7 @@ public class PShader { if (textures != null) { for (int unit: textures.keySet()) { Texture tex = textures.get(unit); - pgl.glActiveTexture(PGL.GL_TEXTURE0 + unit); + pgl.activeTexture(PGL.TEXTURE0 + unit); tex.bind(); } } @@ -607,10 +607,10 @@ public class PShader { if (textures != null) { for (int unit: textures.keySet()) { Texture tex = textures.get(unit); - pgl.glActiveTexture(PGL.GL_TEXTURE0 + unit); + pgl.activeTexture(PGL.TEXTURE0 + unit); tex.unbind(); } - pgl.glActiveTexture(PGL.GL_TEXTURE0); + pgl.activeTexture(PGL.TEXTURE0); } } @@ -650,25 +650,25 @@ public class PShader { if (vertRes && fragRes) { if (hasVert) { - pgl.glAttachShader(glProgram, glVertex); + pgl.attachShader(glProgram, glVertex); } if (hasFrag) { - pgl.glAttachShader(glProgram, glFragment); + pgl.attachShader(glProgram, glFragment); } - pgl.glLinkProgram(glProgram); + pgl.linkProgram(glProgram); int[] linked = new int[1]; - pgl.glGetProgramiv(glProgram, PGL.GL_LINK_STATUS, linked, 0); - if (linked[0] == PGL.GL_FALSE) { - PGraphics.showException("Cannot link shader program:\n" + pgl.glGetProgramInfoLog(glProgram)); + pgl.getProgramiv(glProgram, PGL.LINK_STATUS, linked, 0); + if (linked[0] == PGL.FALSE) { + PGraphics.showException("Cannot link shader program:\n" + pgl.getProgramInfoLog(glProgram)); } - pgl.glValidateProgram(glProgram); + pgl.validateProgram(glProgram); int[] validated = new int[1]; - pgl.glGetProgramiv(glProgram, PGL.GL_VALIDATE_STATUS, validated, 0); - if (validated[0] == PGL.GL_FALSE) { - PGraphics.showException("Cannot validate shader program:\n" + pgl.glGetProgramInfoLog(glProgram)); + pgl.getProgramiv(glProgram, PGL.VALIDATE_STATUS, validated, 0); + if (validated[0] == PGL.FALSE) { + PGraphics.showException("Cannot validate shader program:\n" + pgl.getProgramInfoLog(glProgram)); } } } @@ -750,13 +750,13 @@ public class PShader { protected boolean compileVertexShader() { glVertex = pgMain.createGLSLVertShaderObject(context.code()); - pgl.glShaderSource(glVertex, vertexShaderSource); - pgl.glCompileShader(glVertex); + pgl.shaderSource(glVertex, vertexShaderSource); + pgl.compileShader(glVertex); int[] compiled = new int[1]; - pgl.glGetShaderiv(glVertex, PGL.GL_COMPILE_STATUS, compiled, 0); - if (compiled[0] == PGL.GL_FALSE) { - PGraphics.showException("Cannot compile vertex shader:\n" + pgl.glGetShaderInfoLog(glVertex)); + pgl.getShaderiv(glVertex, PGL.COMPILE_STATUS, compiled, 0); + if (compiled[0] == PGL.FALSE) { + PGraphics.showException("Cannot compile vertex shader:\n" + pgl.getShaderInfoLog(glVertex)); return false; } else { return true; @@ -770,13 +770,13 @@ public class PShader { protected boolean compileFragmentShader() { glFragment = pgMain.createGLSLFragShaderObject(context.code()); - pgl.glShaderSource(glFragment, fragmentShaderSource); - pgl.glCompileShader(glFragment); + pgl.shaderSource(glFragment, fragmentShaderSource); + pgl.compileShader(glFragment); int[] compiled = new int[1]; - pgl.glGetShaderiv(glFragment, PGL.GL_COMPILE_STATUS, compiled, 0); - if (compiled[0] == PGL.GL_FALSE) { - PGraphics.showException("Cannot compile fragment shader:\n" + pgl.glGetShaderInfoLog(glFragment)); + pgl.getShaderiv(glFragment, PGL.COMPILE_STATUS, compiled, 0); + if (compiled[0] == PGL.FALSE) { + PGraphics.showException("Cannot compile fragment shader:\n" + pgl.getShaderInfoLog(glFragment)); return false; } else { return true; diff --git a/core/src/processing/opengl/PShapeOpenGL.java b/core/src/processing/opengl/PShapeOpenGL.java index cf7137859..6b0668763 100644 --- a/core/src/processing/opengl/PShapeOpenGL.java +++ b/core/src/processing/opengl/PShapeOpenGL.java @@ -3123,45 +3123,45 @@ public class PShapeOpenGL extends PShape { int sizei = size * PGL.SIZEOF_INT; glPolyVertex = pg.createVertexBufferObject(context.code()); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPolyVertex); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, 4 * sizef, FloatBuffer.wrap(tessGeo.polyVertices, 0, 4 * size), PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyVertex); + pgl.bufferData(PGL.ARRAY_BUFFER, 4 * sizef, FloatBuffer.wrap(tessGeo.polyVertices, 0, 4 * size), PGL.STATIC_DRAW); glPolyColor = pg.createVertexBufferObject(context.code()); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPolyColor); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, sizei, IntBuffer.wrap(tessGeo.polyColors, 0, size), PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyColor); + pgl.bufferData(PGL.ARRAY_BUFFER, sizei, IntBuffer.wrap(tessGeo.polyColors, 0, size), PGL.STATIC_DRAW); glPolyNormal = pg.createVertexBufferObject(context.code()); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPolyNormal); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, 3 * sizef, FloatBuffer.wrap(tessGeo.polyNormals, 0, 3 * size), PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyNormal); + pgl.bufferData(PGL.ARRAY_BUFFER, 3 * sizef, FloatBuffer.wrap(tessGeo.polyNormals, 0, 3 * size), PGL.STATIC_DRAW); glPolyTexcoord = pg.createVertexBufferObject(context.code()); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPolyTexcoord); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, 2 * sizef, FloatBuffer.wrap(tessGeo.polyTexcoords, 0, 2 * size), PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyTexcoord); + pgl.bufferData(PGL.ARRAY_BUFFER, 2 * sizef, FloatBuffer.wrap(tessGeo.polyTexcoords, 0, 2 * size), PGL.STATIC_DRAW); glPolyAmbient = pg.createVertexBufferObject(context.code()); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPolyAmbient); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, sizei, IntBuffer.wrap(tessGeo.polyAmbient, 0, size), PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyAmbient); + pgl.bufferData(PGL.ARRAY_BUFFER, sizei, IntBuffer.wrap(tessGeo.polyAmbient, 0, size), PGL.STATIC_DRAW); glPolySpecular = pg.createVertexBufferObject(context.code()); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPolySpecular); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, sizei, IntBuffer.wrap(tessGeo.polySpecular, 0, size), PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolySpecular); + pgl.bufferData(PGL.ARRAY_BUFFER, sizei, IntBuffer.wrap(tessGeo.polySpecular, 0, size), PGL.STATIC_DRAW); glPolyEmissive = pg.createVertexBufferObject(context.code()); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPolyEmissive); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, sizei, IntBuffer.wrap(tessGeo.polyEmissive, 0, size), PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyEmissive); + pgl.bufferData(PGL.ARRAY_BUFFER, sizei, IntBuffer.wrap(tessGeo.polyEmissive, 0, size), PGL.STATIC_DRAW); glPolyShininess = pg.createVertexBufferObject(context.code()); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPolyShininess); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, sizef, FloatBuffer.wrap(tessGeo.polyShininess, 0, size), PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyShininess); + pgl.bufferData(PGL.ARRAY_BUFFER, sizef, FloatBuffer.wrap(tessGeo.polyShininess, 0, size), PGL.STATIC_DRAW); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ARRAY_BUFFER, 0); glPolyIndex = pg.createVertexBufferObject(context.code()); - pgl.glBindBuffer(PGL.GL_ELEMENT_ARRAY_BUFFER, glPolyIndex); - pgl.glBufferData(PGL.GL_ELEMENT_ARRAY_BUFFER, tessGeo.polyIndexCount * PGL.SIZEOF_INDEX, - ShortBuffer.wrap(tessGeo.polyIndices, 0, tessGeo.polyIndexCount), PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, glPolyIndex); + pgl.bufferData(PGL.ELEMENT_ARRAY_BUFFER, tessGeo.polyIndexCount * PGL.SIZEOF_INDEX, + ShortBuffer.wrap(tessGeo.polyIndices, 0, tessGeo.polyIndexCount), PGL.STATIC_DRAW); - pgl.glBindBuffer(PGL.GL_ELEMENT_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, 0); } @@ -3171,25 +3171,25 @@ public class PShapeOpenGL extends PShape { int sizei = size * PGL.SIZEOF_INT; glLineVertex = pg.createVertexBufferObject(context.code()); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glLineVertex); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, 4 * sizef, FloatBuffer.wrap(tessGeo.lineVertices, 0, 4 * size), PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glLineVertex); + pgl.bufferData(PGL.ARRAY_BUFFER, 4 * sizef, FloatBuffer.wrap(tessGeo.lineVertices, 0, 4 * size), PGL.STATIC_DRAW); glLineColor = pg.createVertexBufferObject(context.code()); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glLineColor); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, sizei, IntBuffer.wrap(tessGeo.lineColors, 0, size), PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glLineColor); + pgl.bufferData(PGL.ARRAY_BUFFER, sizei, IntBuffer.wrap(tessGeo.lineColors, 0, size), PGL.STATIC_DRAW); glLineAttrib = pg.createVertexBufferObject(context.code()); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glLineAttrib); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, 4 * sizef, FloatBuffer.wrap(tessGeo.lineAttribs, 0, 4 * size), PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glLineAttrib); + pgl.bufferData(PGL.ARRAY_BUFFER, 4 * sizef, FloatBuffer.wrap(tessGeo.lineAttribs, 0, 4 * size), PGL.STATIC_DRAW); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ARRAY_BUFFER, 0); glLineIndex = pg.createVertexBufferObject(context.code()); - pgl.glBindBuffer(PGL.GL_ELEMENT_ARRAY_BUFFER, glLineIndex); - pgl.glBufferData(PGL.GL_ELEMENT_ARRAY_BUFFER, tessGeo.lineIndexCount * PGL.SIZEOF_INDEX, - ShortBuffer.wrap(tessGeo.lineIndices, 0, tessGeo.lineIndexCount), PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, glLineIndex); + pgl.bufferData(PGL.ELEMENT_ARRAY_BUFFER, tessGeo.lineIndexCount * PGL.SIZEOF_INDEX, + ShortBuffer.wrap(tessGeo.lineIndices, 0, tessGeo.lineIndexCount), PGL.STATIC_DRAW); - pgl.glBindBuffer(PGL.GL_ELEMENT_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, 0); } @@ -3199,25 +3199,25 @@ public class PShapeOpenGL extends PShape { int sizei = size * PGL.SIZEOF_INT; glPointVertex = pg.createVertexBufferObject(context.code()); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPointVertex); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, 4 * sizef, FloatBuffer.wrap(tessGeo.pointVertices, 0, 4 * size), PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPointVertex); + pgl.bufferData(PGL.ARRAY_BUFFER, 4 * sizef, FloatBuffer.wrap(tessGeo.pointVertices, 0, 4 * size), PGL.STATIC_DRAW); glPointColor = pg.createVertexBufferObject(context.code()); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPointColor); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, sizei, IntBuffer.wrap(tessGeo.pointColors, 0, size), PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPointColor); + pgl.bufferData(PGL.ARRAY_BUFFER, sizei, IntBuffer.wrap(tessGeo.pointColors, 0, size), PGL.STATIC_DRAW); glPointAttrib = pg.createVertexBufferObject(context.code()); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPointAttrib); - pgl.glBufferData(PGL.GL_ARRAY_BUFFER, 2 * sizef, FloatBuffer.wrap(tessGeo.pointAttribs, 0, 2 * size), PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPointAttrib); + pgl.bufferData(PGL.ARRAY_BUFFER, 2 * sizef, FloatBuffer.wrap(tessGeo.pointAttribs, 0, 2 * size), PGL.STATIC_DRAW); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ARRAY_BUFFER, 0); glPointIndex = pg.createVertexBufferObject(context.code()); - pgl.glBindBuffer(PGL.GL_ELEMENT_ARRAY_BUFFER, glPointIndex); - pgl.glBufferData(PGL.GL_ELEMENT_ARRAY_BUFFER, tessGeo.pointIndexCount * PGL.SIZEOF_INDEX, - ShortBuffer.wrap(tessGeo.pointIndices, 0, tessGeo.pointIndexCount), PGL.GL_STATIC_DRAW); + pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, glPointIndex); + pgl.bufferData(PGL.ELEMENT_ARRAY_BUFFER, tessGeo.pointIndexCount * PGL.SIZEOF_INDEX, + ShortBuffer.wrap(tessGeo.pointIndices, 0, tessGeo.pointIndexCount), PGL.STATIC_DRAW); - pgl.glBindBuffer(PGL.GL_ELEMENT_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, 0); } @@ -3520,114 +3520,114 @@ public class PShapeOpenGL extends PShape { protected void copyPolyVertices(int offset, int size) { - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPolyVertex); - pgl.glBufferSubData(PGL.GL_ARRAY_BUFFER, 4 * offset * PGL.SIZEOF_FLOAT, 4 * size * PGL.SIZEOF_FLOAT, + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyVertex); + pgl.bufferSubData(PGL.ARRAY_BUFFER, 4 * offset * PGL.SIZEOF_FLOAT, 4 * size * PGL.SIZEOF_FLOAT, FloatBuffer.wrap(tessGeo.polyVertices, 4 * offset, 4 * size)); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ARRAY_BUFFER, 0); } protected void copyPolyColors(int offset, int size) { - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPolyColor); - pgl.glBufferSubData(PGL.GL_ARRAY_BUFFER, offset * PGL.SIZEOF_INT, size * PGL.SIZEOF_INT, + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyColor); + pgl.bufferSubData(PGL.ARRAY_BUFFER, offset * PGL.SIZEOF_INT, size * PGL.SIZEOF_INT, IntBuffer.wrap(tessGeo.polyColors, offset, size)); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ARRAY_BUFFER, 0); } protected void copyPolyNormals(int offset, int size) { - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPolyNormal); - pgl.glBufferSubData(PGL.GL_ARRAY_BUFFER, 3 * offset * PGL.SIZEOF_FLOAT, 3 * size * PGL.SIZEOF_FLOAT, + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyNormal); + pgl.bufferSubData(PGL.ARRAY_BUFFER, 3 * offset * PGL.SIZEOF_FLOAT, 3 * size * PGL.SIZEOF_FLOAT, FloatBuffer.wrap(tessGeo.polyNormals, 3 * offset, 3 * size)); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ARRAY_BUFFER, 0); } protected void copyPolyTexcoords(int offset, int size) { - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPolyTexcoord); - pgl.glBufferSubData(PGL.GL_ARRAY_BUFFER, 2 * offset * PGL.SIZEOF_FLOAT, 2 * size * PGL.SIZEOF_FLOAT, + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyTexcoord); + pgl.bufferSubData(PGL.ARRAY_BUFFER, 2 * offset * PGL.SIZEOF_FLOAT, 2 * size * PGL.SIZEOF_FLOAT, FloatBuffer.wrap(tessGeo.polyTexcoords, 2 * offset, 2 * size)); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ARRAY_BUFFER, 0); } protected void copyPolyAmbient(int offset, int size) { - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPolyAmbient); - pgl.glBufferSubData(PGL.GL_ARRAY_BUFFER, offset * PGL.SIZEOF_INT, size * PGL.SIZEOF_INT, + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyAmbient); + pgl.bufferSubData(PGL.ARRAY_BUFFER, offset * PGL.SIZEOF_INT, size * PGL.SIZEOF_INT, IntBuffer.wrap(tessGeo.polyAmbient, offset, size)); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ARRAY_BUFFER, 0); } protected void copyPolySpecular(int offset, int size) { - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPolySpecular); - pgl.glBufferSubData(PGL.GL_ARRAY_BUFFER, offset * PGL.SIZEOF_INT, size * PGL.SIZEOF_INT, + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolySpecular); + pgl.bufferSubData(PGL.ARRAY_BUFFER, offset * PGL.SIZEOF_INT, size * PGL.SIZEOF_INT, IntBuffer.wrap(tessGeo.polySpecular, offset, size)); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ARRAY_BUFFER, 0); } protected void copyPolyEmissive(int offset, int size) { - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPolyEmissive); - pgl.glBufferSubData(PGL.GL_ARRAY_BUFFER, offset * PGL.SIZEOF_INT, size * PGL.SIZEOF_INT, + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyEmissive); + pgl.bufferSubData(PGL.ARRAY_BUFFER, offset * PGL.SIZEOF_INT, size * PGL.SIZEOF_INT, IntBuffer.wrap(tessGeo.polyEmissive, offset, size)); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ARRAY_BUFFER, 0); } protected void copyPolyShininess(int offset, int size) { - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPolyShininess); - pgl.glBufferSubData(PGL.GL_ARRAY_BUFFER, offset * PGL.SIZEOF_FLOAT, size * PGL.SIZEOF_FLOAT, + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyShininess); + pgl.bufferSubData(PGL.ARRAY_BUFFER, offset * PGL.SIZEOF_FLOAT, size * PGL.SIZEOF_FLOAT, FloatBuffer.wrap(tessGeo.polyShininess, offset, size)); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ARRAY_BUFFER, 0); } protected void copyLineVertices(int offset, int size) { - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glLineVertex); - pgl.glBufferSubData(PGL.GL_ARRAY_BUFFER, 4 * offset * PGL.SIZEOF_FLOAT, 4 * size * PGL.SIZEOF_FLOAT, + pgl.bindBuffer(PGL.ARRAY_BUFFER, glLineVertex); + pgl.bufferSubData(PGL.ARRAY_BUFFER, 4 * offset * PGL.SIZEOF_FLOAT, 4 * size * PGL.SIZEOF_FLOAT, FloatBuffer.wrap(tessGeo.lineVertices, 4 * offset, 4 * size)); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ARRAY_BUFFER, 0); } protected void copyLineColors(int offset, int size) { - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glLineColor); - pgl.glBufferSubData(PGL.GL_ARRAY_BUFFER, offset * PGL.SIZEOF_INT, size * PGL.SIZEOF_INT, + pgl.bindBuffer(PGL.ARRAY_BUFFER, glLineColor); + pgl.bufferSubData(PGL.ARRAY_BUFFER, offset * PGL.SIZEOF_INT, size * PGL.SIZEOF_INT, IntBuffer.wrap(tessGeo.lineColors, offset, size)); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ARRAY_BUFFER, 0); } protected void copyLineAttributes(int offset, int size) { - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glLineAttrib); - pgl.glBufferSubData(PGL.GL_ARRAY_BUFFER, 4 * offset * PGL.SIZEOF_FLOAT, 4 * size * PGL.SIZEOF_FLOAT, + pgl.bindBuffer(PGL.ARRAY_BUFFER, glLineAttrib); + pgl.bufferSubData(PGL.ARRAY_BUFFER, 4 * offset * PGL.SIZEOF_FLOAT, 4 * size * PGL.SIZEOF_FLOAT, FloatBuffer.wrap(tessGeo.lineAttribs, 4 * offset, 4 * size)); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ARRAY_BUFFER, 0); } protected void copyPointVertices(int offset, int size) { - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPointVertex); - pgl.glBufferSubData(PGL.GL_ARRAY_BUFFER, 4 * offset * PGL.SIZEOF_FLOAT, 4 * size * PGL.SIZEOF_FLOAT, + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPointVertex); + pgl.bufferSubData(PGL.ARRAY_BUFFER, 4 * offset * PGL.SIZEOF_FLOAT, 4 * size * PGL.SIZEOF_FLOAT, FloatBuffer.wrap(tessGeo.pointVertices, 4 * offset, 4 * size)); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ARRAY_BUFFER, 0); } protected void copyPointColors(int offset, int size) { - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPointColor); - pgl.glBufferSubData(PGL.GL_ARRAY_BUFFER, offset * PGL.SIZEOF_INT, size * PGL.SIZEOF_INT, + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPointColor); + pgl.bufferSubData(PGL.ARRAY_BUFFER, offset * PGL.SIZEOF_INT, size * PGL.SIZEOF_INT, IntBuffer.wrap(tessGeo.pointColors, offset, size)); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ARRAY_BUFFER, 0); } protected void copyPointAttributes(int offset, int size) { - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glPointAttrib); - pgl.glBufferSubData(PGL.GL_ARRAY_BUFFER, 2 * offset * PGL.SIZEOF_FLOAT, 2 * size * PGL.SIZEOF_FLOAT, + pgl.bindBuffer(PGL.ARRAY_BUFFER, glPointAttrib); + pgl.bufferSubData(PGL.ARRAY_BUFFER, 2 * offset * PGL.SIZEOF_FLOAT, 2 * size * PGL.SIZEOF_FLOAT, FloatBuffer.wrap(tessGeo.pointAttribs, 2 * offset, 2 * size)); - pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ARRAY_BUFFER, 0); } @@ -3957,25 +3957,25 @@ public class PShapeOpenGL extends PShape { int icount = cache.indexCount[n]; int voffset = cache.vertexOffset[n]; - shader.setVertexAttribute(root.glPolyVertex, 4, PGL.GL_FLOAT, 0, 4 * voffset * PGL.SIZEOF_FLOAT); - shader.setColorAttribute(root.glPolyColor, 4, PGL.GL_UNSIGNED_BYTE, 0, 4 * voffset * PGL.SIZEOF_BYTE); + shader.setVertexAttribute(root.glPolyVertex, 4, PGL.FLOAT, 0, 4 * voffset * PGL.SIZEOF_FLOAT); + shader.setColorAttribute(root.glPolyColor, 4, PGL.UNSIGNED_BYTE, 0, 4 * voffset * PGL.SIZEOF_BYTE); if (g.lights) { - shader.setNormalAttribute(root.glPolyNormal, 3, PGL.GL_FLOAT, 0, 3 * voffset * PGL.SIZEOF_FLOAT); - shader.setAmbientAttribute(root.glPolyAmbient, 4, PGL.GL_UNSIGNED_BYTE, 0, 4 * voffset * PGL.SIZEOF_BYTE); - shader.setSpecularAttribute(root.glPolySpecular, 4, PGL.GL_UNSIGNED_BYTE, 0, 4 * voffset * PGL.SIZEOF_BYTE); - shader.setEmissiveAttribute(root.glPolyEmissive, 4, PGL.GL_UNSIGNED_BYTE, 0, 4 * voffset * PGL.SIZEOF_BYTE); - shader.setShininessAttribute(root.glPolyShininess, 1, PGL.GL_FLOAT, 0, voffset * PGL.SIZEOF_FLOAT); + shader.setNormalAttribute(root.glPolyNormal, 3, PGL.FLOAT, 0, 3 * voffset * PGL.SIZEOF_FLOAT); + shader.setAmbientAttribute(root.glPolyAmbient, 4, PGL.UNSIGNED_BYTE, 0, 4 * voffset * PGL.SIZEOF_BYTE); + shader.setSpecularAttribute(root.glPolySpecular, 4, PGL.UNSIGNED_BYTE, 0, 4 * voffset * PGL.SIZEOF_BYTE); + shader.setEmissiveAttribute(root.glPolyEmissive, 4, PGL.UNSIGNED_BYTE, 0, 4 * voffset * PGL.SIZEOF_BYTE); + shader.setShininessAttribute(root.glPolyShininess, 1, PGL.FLOAT, 0, voffset * PGL.SIZEOF_FLOAT); } if (tex != null) { - shader.setTexcoordAttribute(root.glPolyTexcoord, 2, PGL.GL_FLOAT, 0, 2 * voffset * PGL.SIZEOF_FLOAT); + shader.setTexcoordAttribute(root.glPolyTexcoord, 2, PGL.FLOAT, 0, 2 * voffset * PGL.SIZEOF_FLOAT); shader.setTexture(tex); } - pgl.glBindBuffer(PGL.GL_ELEMENT_ARRAY_BUFFER, root.glPolyIndex); - pgl.glDrawElements(PGL.GL_TRIANGLES, icount, PGL.INDEX_TYPE, ioffset * PGL.SIZEOF_INDEX); - pgl.glBindBuffer(PGL.GL_ELEMENT_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, root.glPolyIndex); + pgl.drawElements(PGL.TRIANGLES, icount, PGL.INDEX_TYPE, ioffset * PGL.SIZEOF_INDEX); + pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, 0); } if (shader != null && shader.bound()) { @@ -4087,13 +4087,13 @@ public class PShapeOpenGL extends PShape { int icount = cache.indexCount[n]; int voffset = cache.vertexOffset[n]; - shader.setVertexAttribute(root.glLineVertex, 4, PGL.GL_FLOAT, 0, 4 * voffset * PGL.SIZEOF_FLOAT); - shader.setColorAttribute(root.glLineColor, 4, PGL.GL_UNSIGNED_BYTE, 0, 4 * voffset * PGL.SIZEOF_BYTE); - shader.setLineAttribute(root.glLineAttrib, 4, PGL.GL_FLOAT, 0, 4 * voffset * PGL.SIZEOF_FLOAT); + shader.setVertexAttribute(root.glLineVertex, 4, PGL.FLOAT, 0, 4 * voffset * PGL.SIZEOF_FLOAT); + shader.setColorAttribute(root.glLineColor, 4, PGL.UNSIGNED_BYTE, 0, 4 * voffset * PGL.SIZEOF_BYTE); + shader.setLineAttribute(root.glLineAttrib, 4, PGL.FLOAT, 0, 4 * voffset * PGL.SIZEOF_FLOAT); - pgl.glBindBuffer(PGL.GL_ELEMENT_ARRAY_BUFFER, root.glLineIndex); - pgl.glDrawElements(PGL.GL_TRIANGLES, icount, PGL.INDEX_TYPE, ioffset * PGL.SIZEOF_INDEX); - pgl.glBindBuffer(PGL.GL_ELEMENT_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, root.glLineIndex); + pgl.drawElements(PGL.TRIANGLES, icount, PGL.INDEX_TYPE, ioffset * PGL.SIZEOF_INDEX); + pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, 0); } shader.unbind(); @@ -4181,13 +4181,13 @@ public class PShapeOpenGL extends PShape { int icount = cache.indexCount[n]; int voffset = cache.vertexOffset[n]; - shader.setVertexAttribute(root.glPointVertex, 4, PGL.GL_FLOAT, 0, 4 * voffset * PGL.SIZEOF_FLOAT); - shader.setColorAttribute(root.glPointColor, 4, PGL.GL_UNSIGNED_BYTE, 0, 4 * voffset * PGL.SIZEOF_BYTE); - shader.setPointAttribute(root.glPointAttrib, 2, PGL.GL_FLOAT, 0, 2 * voffset * PGL.SIZEOF_FLOAT); + shader.setVertexAttribute(root.glPointVertex, 4, PGL.FLOAT, 0, 4 * voffset * PGL.SIZEOF_FLOAT); + shader.setColorAttribute(root.glPointColor, 4, PGL.UNSIGNED_BYTE, 0, 4 * voffset * PGL.SIZEOF_BYTE); + shader.setPointAttribute(root.glPointAttrib, 2, PGL.FLOAT, 0, 2 * voffset * PGL.SIZEOF_FLOAT); - pgl.glBindBuffer(PGL.GL_ELEMENT_ARRAY_BUFFER, root.glPointIndex); - pgl.glDrawElements(PGL.GL_TRIANGLES, icount, PGL.INDEX_TYPE, ioffset * PGL.SIZEOF_INDEX); - pgl.glBindBuffer(PGL.GL_ELEMENT_ARRAY_BUFFER, 0); + pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, root.glPointIndex); + pgl.drawElements(PGL.TRIANGLES, icount, PGL.INDEX_TYPE, ioffset * PGL.SIZEOF_INDEX); + pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, 0); } shader.unbind(); diff --git a/core/src/processing/opengl/Texture.java b/core/src/processing/opengl/Texture.java index c79ffd541..84eb2328d 100644 --- a/core/src/processing/opengl/Texture.java +++ b/core/src/processing/opengl/Texture.java @@ -297,15 +297,15 @@ public class Texture implements PConstants { pgl.enableTexturing(glTarget); enabledTex = true; } - pgl.glBindTexture(glTarget, glName); + pgl.bindTexture(glTarget, glName); if (usingMipmaps) { if (PGraphicsOpenGL.autoMipmapGenSupported) { // Automatic mipmap generation. int[] rgbaPixels = new int[w * h]; convertToRGBA(pixels, rgbaPixels, format, w, h); - pgl.glTexSubImage2D(glTarget, 0, x, y, w, h, PGL.GL_RGBA, PGL.GL_UNSIGNED_BYTE, IntBuffer.wrap(rgbaPixels)); - pgl.glGenerateMipmap(glTarget); + pgl.texSubImage2D(glTarget, 0, x, y, w, h, PGL.RGBA, PGL.UNSIGNED_BYTE, IntBuffer.wrap(rgbaPixels)); + pgl.generateMipmap(glTarget); rgbaPixels = null; } else { // TODO: finish manual mipmap generation, replacing Bitmap with AWT's BufferedImage, @@ -364,17 +364,17 @@ public class Texture implements PConstants { int[] rgbaPixels = new int[w * h]; convertToRGBA(pixels, rgbaPixels, format, w, h); - pgl.glTexSubImage2D(glTarget, 0, x, y, w, h, PGL.GL_RGBA, PGL.GL_UNSIGNED_BYTE, IntBuffer.wrap(rgbaPixels)); + pgl.texSubImage2D(glTarget, 0, x, y, w, h, PGL.RGBA, PGL.UNSIGNED_BYTE, IntBuffer.wrap(rgbaPixels)); rgbaPixels = null; } } else { int[] rgbaPixels = new int[w * h]; convertToRGBA(pixels, rgbaPixels, format, w, h); - pgl.glTexSubImage2D(glTarget, 0, x, y, w, h, PGL.GL_RGBA, PGL.GL_UNSIGNED_BYTE, IntBuffer.wrap(rgbaPixels)); + pgl.texSubImage2D(glTarget, 0, x, y, w, h, PGL.RGBA, PGL.UNSIGNED_BYTE, IntBuffer.wrap(rgbaPixels)); rgbaPixels = null; } - pgl.glBindTexture(glTarget, 0); + pgl.bindTexture(glTarget, 0); if (enabledTex) { pgl.disableTexturing(glTarget); } @@ -419,20 +419,20 @@ public class Texture implements PConstants { pgl.enableTexturing(glTarget); enabledTex = true; } - pgl.glBindTexture(glTarget, glName); + pgl.bindTexture(glTarget, glName); if (usingMipmaps) { if (PGraphicsOpenGL.autoMipmapGenSupported) { - pgl.glTexSubImage2D(glTarget, 0, x, y, w, h, PGL.GL_RGBA, PGL.GL_UNSIGNED_BYTE, pixels); - pgl.glGenerateMipmap(glTarget); + pgl.texSubImage2D(glTarget, 0, x, y, w, h, PGL.RGBA, PGL.UNSIGNED_BYTE, pixels); + pgl.generateMipmap(glTarget); } else { - pgl.glTexSubImage2D(glTarget, 0, x, y, w, h, PGL.GL_RGBA, PGL.GL_UNSIGNED_BYTE, pixels); + pgl.texSubImage2D(glTarget, 0, x, y, w, h, PGL.RGBA, PGL.UNSIGNED_BYTE, pixels); } } else { - pgl.glTexSubImage2D(glTarget, 0, x, y, w, h, PGL.GL_RGBA, PGL.GL_UNSIGNED_BYTE, pixels); + pgl.texSubImage2D(glTarget, 0, x, y, w, h, PGL.RGBA, PGL.UNSIGNED_BYTE, pixels); } - pgl.glBindTexture(glTarget, 0); + pgl.bindTexture(glTarget, 0); if (enabledTex) { pgl.disableTexturing(glTarget); } @@ -602,7 +602,7 @@ public class Texture implements PConstants { if (!pgl.texturingIsEnabled(glTarget)) { pgl.enableTexturing(glTarget); } - pgl.glBindTexture(glTarget, glName); + pgl.bindTexture(glTarget, glName); bound = true; } @@ -613,10 +613,10 @@ public class Texture implements PConstants { // that might be bound instead of this one. if (!pgl.texturingIsEnabled(glTarget)) { pgl.enableTexturing(glTarget); - pgl.glBindTexture(glTarget, 0); + pgl.bindTexture(glTarget, 0); pgl.disableTexturing(glTarget); } else { - pgl.glBindTexture(glTarget, 0); + pgl.bindTexture(glTarget, 0); } } bound = false; @@ -1086,20 +1086,20 @@ public class Texture implements PConstants { context = pgl.getCurrentContext(); glName = pg.createTextureObject(context.code()); - pgl.glBindTexture(glTarget, glName); - pgl.glTexParameteri(glTarget, PGL.GL_TEXTURE_MIN_FILTER, glMinFilter); - pgl.glTexParameteri(glTarget, PGL.GL_TEXTURE_MAG_FILTER, glMagFilter); - pgl.glTexParameteri(glTarget, PGL.GL_TEXTURE_WRAP_S, glWrapS); - pgl.glTexParameteri(glTarget, PGL.GL_TEXTURE_WRAP_T, glWrapT); + pgl.bindTexture(glTarget, glName); + pgl.texParameteri(glTarget, PGL.TEXTURE_MIN_FILTER, glMinFilter); + pgl.texParameteri(glTarget, PGL.TEXTURE_MAG_FILTER, glMagFilter); + pgl.texParameteri(glTarget, PGL.TEXTURE_WRAP_S, glWrapS); + pgl.texParameteri(glTarget, PGL.TEXTURE_WRAP_T, glWrapT); // First, we use glTexImage2D to set the full size of the texture (glW/glH might be diff // from w/h in the case that the GPU doesn't support NPOT textures) - pgl.glTexImage2D(glTarget, 0, glFormat, glWidth, glHeight, 0, PGL.GL_RGBA, PGL.GL_UNSIGNED_BYTE, null); + pgl.texImage2D(glTarget, 0, glFormat, glWidth, glHeight, 0, PGL.RGBA, PGL.UNSIGNED_BYTE, null); // Makes sure that the texture buffer in video memory doesn't contain any garbage. - pgl.initTexture(glTarget, PGL.GL_RGBA, width, height); + pgl.initTexture(glTarget, PGL.RGBA, width, height); - pgl.glBindTexture(glTarget, 0); + pgl.bindTexture(glTarget, 0); if (enabledTex) { pgl.disableTexturing(glTarget); } @@ -1242,47 +1242,47 @@ public class Texture implements PConstants { public Parameters getParameters() { Parameters res = new Parameters(); - if (glTarget == PGL.GL_TEXTURE_2D) { + if (glTarget == PGL.TEXTURE_2D) { res.target = TEX2D; } - if (glFormat == PGL.GL_RGB) { + if (glFormat == PGL.RGB) { res.format = RGB; - } else if (glFormat == PGL.GL_RGBA) { + } else if (glFormat == PGL.RGBA) { res.format = ARGB; - } else if (glFormat == PGL.GL_ALPHA) { + } else if (glFormat == PGL.ALPHA) { res.format = ALPHA; } - if (glMagFilter == PGL.GL_NEAREST && glMinFilter == PGL.GL_NEAREST) { + if (glMagFilter == PGL.NEAREST && glMinFilter == PGL.NEAREST) { res.sampling = POINT; res.mipmaps = false; - } else if (glMagFilter == PGL.GL_NEAREST && glMinFilter == PGL.GL_LINEAR) { + } else if (glMagFilter == PGL.NEAREST && glMinFilter == PGL.LINEAR) { res.sampling = LINEAR; res.mipmaps = false; - } else if (glMagFilter == PGL.GL_NEAREST && glMinFilter == PGL.GL_LINEAR_MIPMAP_NEAREST) { + } else if (glMagFilter == PGL.NEAREST && glMinFilter == PGL.LINEAR_MIPMAP_NEAREST) { res.sampling = LINEAR; res.mipmaps = true; - } else if (glMagFilter == PGL.GL_LINEAR && glMinFilter == PGL.GL_LINEAR) { + } else if (glMagFilter == PGL.LINEAR && glMinFilter == PGL.LINEAR) { res.sampling = BILINEAR; res.mipmaps = false; - } else if (glMagFilter == PGL.GL_LINEAR && glMinFilter == PGL.GL_LINEAR_MIPMAP_NEAREST) { + } else if (glMagFilter == PGL.LINEAR && glMinFilter == PGL.LINEAR_MIPMAP_NEAREST) { res.sampling = BILINEAR; res.mipmaps = true; - } else if (glMagFilter == PGL.GL_LINEAR && glMinFilter == PGL.GL_LINEAR_MIPMAP_LINEAR) { + } else if (glMagFilter == PGL.LINEAR && glMinFilter == PGL.LINEAR_MIPMAP_LINEAR) { res.sampling = TRILINEAR; res.mipmaps = true; } - if (glWrapS == PGL.GL_CLAMP_TO_EDGE) { + if (glWrapS == PGL.CLAMP_TO_EDGE) { res.wrapU = CLAMP; - } else if (glWrapS == PGL.GL_REPEAT) { + } else if (glWrapS == PGL.REPEAT) { res.wrapU = REPEAT; } - if (glWrapT == PGL.GL_CLAMP_TO_EDGE) { + if (glWrapT == PGL.CLAMP_TO_EDGE) { res.wrapV = CLAMP; - } else if (glWrapT == PGL.GL_REPEAT) { + } else if (glWrapT == PGL.REPEAT) { res.wrapV = REPEAT; } @@ -1297,55 +1297,55 @@ public class Texture implements PConstants { */ protected void setParameters(Parameters params) { if (params.target == TEX2D) { - glTarget = PGL.GL_TEXTURE_2D; + glTarget = PGL.TEXTURE_2D; } else { throw new RuntimeException("Unknown texture target"); } if (params.format == RGB) { - glFormat = PGL.GL_RGB; + glFormat = PGL.RGB; } else if (params.format == ARGB) { - glFormat = PGL.GL_RGBA; + glFormat = PGL.RGBA; } else if (params.format == ALPHA) { - glFormat = PGL.GL_ALPHA; + glFormat = PGL.ALPHA; } else { throw new RuntimeException("Unknown texture format"); } if (params.sampling == POINT) { - glMagFilter = PGL.GL_NEAREST; - glMinFilter = PGL.GL_NEAREST; + glMagFilter = PGL.NEAREST; + glMinFilter = PGL.NEAREST; } else if (params.sampling == LINEAR) { - glMagFilter = PGL.GL_NEAREST; - glMinFilter = params.mipmaps && PGL.MIPMAPS_ENABLED ? PGL.GL_LINEAR_MIPMAP_NEAREST : PGL.GL_LINEAR; + glMagFilter = PGL.NEAREST; + glMinFilter = params.mipmaps && PGL.MIPMAPS_ENABLED ? PGL.LINEAR_MIPMAP_NEAREST : PGL.LINEAR; } else if (params.sampling == BILINEAR) { - glMagFilter = PGL.GL_LINEAR; - glMinFilter = params.mipmaps && PGL.MIPMAPS_ENABLED ? PGL.GL_LINEAR_MIPMAP_NEAREST : PGL.GL_LINEAR; + glMagFilter = PGL.LINEAR; + glMinFilter = params.mipmaps && PGL.MIPMAPS_ENABLED ? PGL.LINEAR_MIPMAP_NEAREST : PGL.LINEAR; } else if (params.sampling == TRILINEAR) { - glMagFilter = PGL.GL_LINEAR; - glMinFilter = params.mipmaps && PGL.MIPMAPS_ENABLED ? PGL.GL_LINEAR_MIPMAP_LINEAR : PGL.GL_LINEAR; + glMagFilter = PGL.LINEAR; + glMinFilter = params.mipmaps && PGL.MIPMAPS_ENABLED ? PGL.LINEAR_MIPMAP_LINEAR : PGL.LINEAR; } else { throw new RuntimeException("Unknown texture filtering mode"); } if (params.wrapU == CLAMP) { - glWrapS = PGL.GL_CLAMP_TO_EDGE; + glWrapS = PGL.CLAMP_TO_EDGE; } else if (params.wrapU == REPEAT) { - glWrapS = PGL.GL_REPEAT; + glWrapS = PGL.REPEAT; } else { throw new RuntimeException("Unknown wrapping mode"); } if (params.wrapV == CLAMP) { - glWrapT = PGL.GL_CLAMP_TO_EDGE; + glWrapT = PGL.CLAMP_TO_EDGE; } else if (params.wrapV == REPEAT) { - glWrapT = PGL.GL_REPEAT; + glWrapT = PGL.REPEAT; } else { throw new RuntimeException("Unknown wrapping mode"); } - usingMipmaps = glMinFilter == PGL.GL_LINEAR_MIPMAP_NEAREST || - glMinFilter == PGL.GL_LINEAR_MIPMAP_LINEAR; + usingMipmaps = glMinFilter == PGL.LINEAR_MIPMAP_NEAREST || + glMinFilter == PGL.LINEAR_MIPMAP_LINEAR; flippedX = false; flippedY = false;