mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Added static context variable to PGL, in order to detect surface restarts. Fixed issue 1146
This commit is contained in:
@@ -145,19 +145,19 @@ public class FrameBuffer implements PConstants {
|
||||
protected void finalize() throws Throwable {
|
||||
try {
|
||||
if (glFbo != 0) {
|
||||
pg.finalizeFrameBufferObject(glFbo, context.code());
|
||||
pg.finalizeFrameBufferObject(glFbo, context.id());
|
||||
}
|
||||
if (glDepth != 0) {
|
||||
pg.finalizeRenderBufferObject(glDepth, context.code());
|
||||
pg.finalizeRenderBufferObject(glDepth, context.id());
|
||||
}
|
||||
if (glStencil != 0) {
|
||||
pg.finalizeRenderBufferObject(glStencil, context.code());
|
||||
pg.finalizeRenderBufferObject(glStencil, context.id());
|
||||
}
|
||||
if (glMultisample != 0) {
|
||||
pg.finalizeRenderBufferObject(glMultisample, context.code());
|
||||
pg.finalizeRenderBufferObject(glMultisample, context.id());
|
||||
}
|
||||
if (glDepthStencil != 0) {
|
||||
pg.finalizeRenderBufferObject(glDepthStencil, context.code());
|
||||
pg.finalizeRenderBufferObject(glDepthStencil, context.id());
|
||||
}
|
||||
} finally {
|
||||
super.finalize();
|
||||
@@ -290,7 +290,7 @@ public class FrameBuffer implements PConstants {
|
||||
if (screenFb) {
|
||||
glFbo = 0;
|
||||
} else {
|
||||
glFbo = pg.createFrameBufferObject(context.code());
|
||||
glFbo = pg.createFrameBufferObject(context.id());
|
||||
}
|
||||
|
||||
// create the rest of the stuff...
|
||||
@@ -313,23 +313,23 @@ public class FrameBuffer implements PConstants {
|
||||
|
||||
protected void release() {
|
||||
if (glFbo != 0) {
|
||||
pg.finalizeFrameBufferObject(glFbo, context.code());
|
||||
pg.finalizeFrameBufferObject(glFbo, context.id());
|
||||
glFbo = 0;
|
||||
}
|
||||
if (glDepth != 0) {
|
||||
pg.finalizeRenderBufferObject(glDepth, context.code());
|
||||
pg.finalizeRenderBufferObject(glDepth, context.id());
|
||||
glDepth = 0;
|
||||
}
|
||||
if (glStencil != 0) {
|
||||
pg.finalizeRenderBufferObject(glStencil, context.code());
|
||||
pg.finalizeRenderBufferObject(glStencil, context.id());
|
||||
glStencil = 0;
|
||||
}
|
||||
if (glMultisample != 0) {
|
||||
pg.finalizeRenderBufferObject(glMultisample, context.code());
|
||||
pg.finalizeRenderBufferObject(glMultisample, context.id());
|
||||
glMultisample = 0;
|
||||
}
|
||||
if (glDepthStencil != 0) {
|
||||
pg.finalizeRenderBufferObject(glDepthStencil, context.code());
|
||||
pg.finalizeRenderBufferObject(glDepthStencil, context.id());
|
||||
glDepthStencil = 0;
|
||||
}
|
||||
}
|
||||
@@ -338,11 +338,11 @@ public class FrameBuffer implements PConstants {
|
||||
protected boolean contextIsOutdated() {
|
||||
boolean outdated = !pgl.contextIsCurrent(context);
|
||||
if (outdated) {
|
||||
pg.removeFrameBufferObject(glFbo, context.code());
|
||||
pg.removeRenderBufferObject(glDepth, context.code());
|
||||
pg.removeRenderBufferObject(glStencil, context.code());
|
||||
pg.removeRenderBufferObject(glDepthStencil, context.code());
|
||||
pg.removeRenderBufferObject(glMultisample, context.code());
|
||||
pg.removeFrameBufferObject(glFbo, context.id());
|
||||
pg.removeRenderBufferObject(glDepth, context.id());
|
||||
pg.removeRenderBufferObject(glStencil, context.id());
|
||||
pg.removeRenderBufferObject(glDepthStencil, context.id());
|
||||
pg.removeRenderBufferObject(glMultisample, context.id());
|
||||
|
||||
glFbo = 0;
|
||||
glDepth = 0;
|
||||
@@ -364,7 +364,7 @@ public class FrameBuffer implements PConstants {
|
||||
pg.pushFramebuffer();
|
||||
pg.setFramebuffer(this);
|
||||
|
||||
glMultisample = pg.createRenderBufferObject(context.code());
|
||||
glMultisample = pg.createRenderBufferObject(context.id());
|
||||
pgl.bindRenderbuffer(PGL.RENDERBUFFER, glMultisample);
|
||||
pgl.renderbufferStorageMultisample(PGL.RENDERBUFFER, nsamples,
|
||||
PGL.RGBA8, width, height);
|
||||
@@ -385,7 +385,7 @@ public class FrameBuffer implements PConstants {
|
||||
pg.pushFramebuffer();
|
||||
pg.setFramebuffer(this);
|
||||
|
||||
glDepthStencil = pg.createRenderBufferObject(context.code());
|
||||
glDepthStencil = pg.createRenderBufferObject(context.id());
|
||||
pgl.bindRenderbuffer(PGL.RENDERBUFFER, glDepthStencil);
|
||||
|
||||
if (multisample) {
|
||||
@@ -415,7 +415,7 @@ public class FrameBuffer implements PConstants {
|
||||
pg.pushFramebuffer();
|
||||
pg.setFramebuffer(this);
|
||||
|
||||
glDepth = pg.createRenderBufferObject(context.code());
|
||||
glDepth = pg.createRenderBufferObject(context.id());
|
||||
pgl.bindRenderbuffer(PGL.RENDERBUFFER, glDepth);
|
||||
|
||||
int glConst = PGL.DEPTH_COMPONENT16;
|
||||
@@ -451,7 +451,7 @@ public class FrameBuffer implements PConstants {
|
||||
pg.pushFramebuffer();
|
||||
pg.setFramebuffer(this);
|
||||
|
||||
glStencil = pg.createRenderBufferObject(context.code());
|
||||
glStencil = pg.createRenderBufferObject(context.id());
|
||||
pgl.bindRenderbuffer(PGL.RENDERBUFFER, glStencil);
|
||||
|
||||
int glConst = PGL.STENCIL_INDEX1;
|
||||
|
||||
@@ -249,7 +249,7 @@ class PFontTexture implements PConstants {
|
||||
}
|
||||
if (outdated) {
|
||||
for (int i = 0; i < textures.length; i++) {
|
||||
pg.removeTextureObject(textures[i].glName, textures[i].context.code());
|
||||
pg.removeTextureObject(textures[i].glName, textures[i].context.id());
|
||||
textures[i].glName = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -318,6 +318,9 @@ public class PGL {
|
||||
|
||||
/** GLU interface **/
|
||||
public PGLU glu;
|
||||
|
||||
/** The current opengl context */
|
||||
static public EGLContext context;
|
||||
|
||||
/** The PGraphics object using this interface */
|
||||
protected PGraphicsOpenGL pg;
|
||||
@@ -328,7 +331,7 @@ public class PGL {
|
||||
/** The renderer object driving the rendering loop,
|
||||
* analogous to the GLEventListener in JOGL */
|
||||
protected AndroidRenderer renderer;
|
||||
|
||||
|
||||
/** Which texturing targets are enabled */
|
||||
protected static boolean[] texturingTargets = { false };
|
||||
|
||||
@@ -1284,25 +1287,41 @@ public class PGL {
|
||||
|
||||
|
||||
protected Context getCurrentContext() {
|
||||
return new Context();
|
||||
return new Context(context);
|
||||
}
|
||||
|
||||
|
||||
protected class Context {
|
||||
protected int id;
|
||||
|
||||
Context() {
|
||||
Context() {
|
||||
id = -1;
|
||||
}
|
||||
|
||||
|
||||
Context(EGLContext context) {
|
||||
if (context != null) {
|
||||
id = context.hashCode();
|
||||
} else {
|
||||
id = -1;
|
||||
}
|
||||
}
|
||||
|
||||
boolean current() {
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean equal() {
|
||||
return true;
|
||||
return equal(context);
|
||||
}
|
||||
|
||||
int code() {
|
||||
return 0;
|
||||
|
||||
boolean equal(EGLContext context) {
|
||||
if (id == -1 || context == null) {
|
||||
// A null context means a still non-created resource,
|
||||
// so it is considered equal to the argument.
|
||||
return true;
|
||||
} else {
|
||||
return id == context.hashCode();
|
||||
}
|
||||
}
|
||||
|
||||
int id() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2035,6 +2054,7 @@ public class PGL {
|
||||
|
||||
public void onSurfaceCreated(GL10 igl, EGLConfig config) {
|
||||
gl = igl;
|
||||
context = ((EGL10)EGLContext.getEGL()).eglGetCurrentContext();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1153,45 +1153,45 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
int sizei = INIT_VERTEX_BUFFER_SIZE * PGL.SIZEOF_INT;
|
||||
int sizex = INIT_INDEX_BUFFER_SIZE * PGL.SIZEOF_INDEX;
|
||||
|
||||
glPolyVertex = createVertexBufferObject(polyBuffersContext.code());
|
||||
glPolyVertex = createVertexBufferObject(polyBuffersContext.id());
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyVertex);
|
||||
pgl.bufferData(PGL.ARRAY_BUFFER, 3 * sizef, null, PGL.STATIC_DRAW);
|
||||
|
||||
glPolyColor = createVertexBufferObject(polyBuffersContext.code());
|
||||
glPolyColor = createVertexBufferObject(polyBuffersContext.id());
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyColor);
|
||||
pgl.bufferData(PGL.ARRAY_BUFFER, sizei, null, PGL.STATIC_DRAW);
|
||||
|
||||
glPolyNormal = createVertexBufferObject(polyBuffersContext.code());
|
||||
glPolyNormal = createVertexBufferObject(polyBuffersContext.id());
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyNormal);
|
||||
pgl.bufferData(PGL.ARRAY_BUFFER, 3 * sizef, null, PGL.STATIC_DRAW);
|
||||
|
||||
glPolyTexcoord = createVertexBufferObject(polyBuffersContext.code());
|
||||
glPolyTexcoord = createVertexBufferObject(polyBuffersContext.id());
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyTexcoord);
|
||||
pgl.bufferData(PGL.ARRAY_BUFFER, 2 * sizef, null, PGL.STATIC_DRAW);
|
||||
|
||||
glPolyAmbient = pgPrimary.createVertexBufferObject(
|
||||
polyBuffersContext.code());
|
||||
polyBuffersContext.id());
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyAmbient);
|
||||
pgl.bufferData(PGL.ARRAY_BUFFER, sizei, null, PGL.STATIC_DRAW);
|
||||
|
||||
glPolySpecular = pgPrimary.createVertexBufferObject(
|
||||
polyBuffersContext.code());
|
||||
polyBuffersContext.id());
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolySpecular);
|
||||
pgl.bufferData(PGL.ARRAY_BUFFER, sizei, null, PGL.STATIC_DRAW);
|
||||
|
||||
glPolyEmissive = pgPrimary.createVertexBufferObject(
|
||||
polyBuffersContext.code());
|
||||
polyBuffersContext.id());
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyEmissive);
|
||||
pgl.bufferData(PGL.ARRAY_BUFFER, sizei, null, PGL.STATIC_DRAW);
|
||||
|
||||
glPolyShininess = pgPrimary.createVertexBufferObject(
|
||||
polyBuffersContext.code());
|
||||
polyBuffersContext.id());
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyShininess);
|
||||
pgl.bufferData(PGL.ARRAY_BUFFER, sizef, null, PGL.STATIC_DRAW);
|
||||
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
|
||||
|
||||
glPolyIndex = createVertexBufferObject(polyBuffersContext.code());
|
||||
glPolyIndex = createVertexBufferObject(polyBuffersContext.id());
|
||||
pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, glPolyIndex);
|
||||
pgl.bufferData(PGL.ELEMENT_ARRAY_BUFFER, sizex, null, PGL.STATIC_DRAW);
|
||||
|
||||
@@ -1266,31 +1266,31 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
|
||||
protected void deletePolyBuffers() {
|
||||
if (polyBuffersCreated) {
|
||||
deleteVertexBufferObject(glPolyVertex, polyBuffersContext.code());
|
||||
deleteVertexBufferObject(glPolyVertex, polyBuffersContext.id());
|
||||
glPolyVertex = 0;
|
||||
|
||||
deleteVertexBufferObject(glPolyColor, polyBuffersContext.code());
|
||||
deleteVertexBufferObject(glPolyColor, polyBuffersContext.id());
|
||||
glPolyColor = 0;
|
||||
|
||||
deleteVertexBufferObject(glPolyNormal, polyBuffersContext.code());
|
||||
deleteVertexBufferObject(glPolyNormal, polyBuffersContext.id());
|
||||
glPolyNormal = 0;
|
||||
|
||||
deleteVertexBufferObject(glPolyTexcoord, polyBuffersContext.code());
|
||||
deleteVertexBufferObject(glPolyTexcoord, polyBuffersContext.id());
|
||||
glPolyTexcoord = 0;
|
||||
|
||||
deleteVertexBufferObject(glPolyAmbient, polyBuffersContext.code());
|
||||
deleteVertexBufferObject(glPolyAmbient, polyBuffersContext.id());
|
||||
glPolyAmbient = 0;
|
||||
|
||||
deleteVertexBufferObject(glPolySpecular, polyBuffersContext.code());
|
||||
deleteVertexBufferObject(glPolySpecular, polyBuffersContext.id());
|
||||
glPolySpecular = 0;
|
||||
|
||||
deleteVertexBufferObject(glPolyEmissive, polyBuffersContext.code());
|
||||
deleteVertexBufferObject(glPolyEmissive, polyBuffersContext.id());
|
||||
glPolyEmissive = 0;
|
||||
|
||||
deleteVertexBufferObject(glPolyShininess, polyBuffersContext.code());
|
||||
deleteVertexBufferObject(glPolyShininess, polyBuffersContext.id());
|
||||
glPolyShininess = 0;
|
||||
|
||||
deleteVertexBufferObject(glPolyIndex, polyBuffersContext.code());
|
||||
deleteVertexBufferObject(glPolyIndex, polyBuffersContext.id());
|
||||
glPolyIndex = 0;
|
||||
|
||||
polyBuffersCreated = false;
|
||||
@@ -1306,22 +1306,22 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
int sizei = INIT_VERTEX_BUFFER_SIZE * PGL.SIZEOF_INT;
|
||||
int sizex = INIT_INDEX_BUFFER_SIZE * PGL.SIZEOF_INDEX;
|
||||
|
||||
glLineVertex = createVertexBufferObject(lineBuffersContext.code());
|
||||
glLineVertex = createVertexBufferObject(lineBuffersContext.id());
|
||||
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, glLineVertex);
|
||||
pgl.bufferData(PGL.ARRAY_BUFFER, 3 * sizef, null, PGL.STATIC_DRAW);
|
||||
|
||||
glLineColor = createVertexBufferObject(lineBuffersContext.code());
|
||||
glLineColor = createVertexBufferObject(lineBuffersContext.id());
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, glLineColor);
|
||||
pgl.bufferData(PGL.ARRAY_BUFFER, sizei, null, PGL.STATIC_DRAW);
|
||||
|
||||
glLineAttrib = createVertexBufferObject(lineBuffersContext.code());
|
||||
glLineAttrib = createVertexBufferObject(lineBuffersContext.id());
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, glLineAttrib);
|
||||
pgl.bufferData(PGL.ARRAY_BUFFER, 4 * sizef, null, PGL.STATIC_DRAW);
|
||||
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
|
||||
|
||||
glLineIndex = createVertexBufferObject(lineBuffersContext.code());
|
||||
glLineIndex = createVertexBufferObject(lineBuffersContext.id());
|
||||
pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, glLineIndex);
|
||||
pgl.bufferData(PGL.ELEMENT_ARRAY_BUFFER, sizex, null, PGL.STATIC_DRAW);
|
||||
|
||||
@@ -1372,16 +1372,16 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
|
||||
protected void deleteLineBuffers() {
|
||||
if (lineBuffersCreated) {
|
||||
deleteVertexBufferObject(glLineVertex, lineBuffersContext.code());
|
||||
deleteVertexBufferObject(glLineVertex, lineBuffersContext.id());
|
||||
glLineVertex = 0;
|
||||
|
||||
deleteVertexBufferObject(glLineColor, lineBuffersContext.code());
|
||||
deleteVertexBufferObject(glLineColor, lineBuffersContext.id());
|
||||
glLineColor = 0;
|
||||
|
||||
deleteVertexBufferObject(glLineAttrib, lineBuffersContext.code());
|
||||
deleteVertexBufferObject(glLineAttrib, lineBuffersContext.id());
|
||||
glLineAttrib = 0;
|
||||
|
||||
deleteVertexBufferObject(glLineIndex, lineBuffersContext.code());
|
||||
deleteVertexBufferObject(glLineIndex, lineBuffersContext.id());
|
||||
glLineIndex = 0;
|
||||
|
||||
lineBuffersCreated = false;
|
||||
@@ -1397,21 +1397,21 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
int sizei = INIT_VERTEX_BUFFER_SIZE * PGL.SIZEOF_INT;
|
||||
int sizex = INIT_INDEX_BUFFER_SIZE * PGL.SIZEOF_INDEX;
|
||||
|
||||
glPointVertex = createVertexBufferObject(pointBuffersContext.code());
|
||||
glPointVertex = createVertexBufferObject(pointBuffersContext.id());
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPointVertex);
|
||||
pgl.bufferData(PGL.ARRAY_BUFFER, 3 * sizef, null, PGL.STATIC_DRAW);
|
||||
|
||||
glPointColor = createVertexBufferObject(pointBuffersContext.code());
|
||||
glPointColor = createVertexBufferObject(pointBuffersContext.id());
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPointColor);
|
||||
pgl.bufferData(PGL.ARRAY_BUFFER, sizei, null, PGL.STATIC_DRAW);
|
||||
|
||||
glPointAttrib = createVertexBufferObject(pointBuffersContext.code());
|
||||
glPointAttrib = createVertexBufferObject(pointBuffersContext.id());
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPointAttrib);
|
||||
pgl.bufferData(PGL.ARRAY_BUFFER, 2 * sizef, null, PGL.STATIC_DRAW);
|
||||
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
|
||||
|
||||
glPointIndex = createVertexBufferObject(pointBuffersContext.code());
|
||||
glPointIndex = createVertexBufferObject(pointBuffersContext.id());
|
||||
pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, glPointIndex);
|
||||
pgl.bufferData(PGL.ELEMENT_ARRAY_BUFFER, sizex, null, PGL.STATIC_DRAW);
|
||||
|
||||
@@ -1462,16 +1462,16 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
|
||||
protected void deletePointBuffers() {
|
||||
if (pointBuffersCreated) {
|
||||
deleteVertexBufferObject(glPointVertex, pointBuffersContext.code());
|
||||
deleteVertexBufferObject(glPointVertex, pointBuffersContext.id());
|
||||
glPointVertex = 0;
|
||||
|
||||
deleteVertexBufferObject(glPointColor, pointBuffersContext.code());
|
||||
deleteVertexBufferObject(glPointColor, pointBuffersContext.id());
|
||||
glPointColor = 0;
|
||||
|
||||
deleteVertexBufferObject(glPointAttrib, pointBuffersContext.code());
|
||||
deleteVertexBufferObject(glPointAttrib, pointBuffersContext.id());
|
||||
glPointAttrib = 0;
|
||||
|
||||
deleteVertexBufferObject(glPointIndex, pointBuffersContext.code());
|
||||
deleteVertexBufferObject(glPointIndex, pointBuffersContext.id());
|
||||
glPointIndex = 0;
|
||||
|
||||
pointBuffersCreated = false;
|
||||
|
||||
@@ -151,13 +151,13 @@ public class PShader {
|
||||
protected void finalize() throws Throwable {
|
||||
try {
|
||||
if (glVertex != 0) {
|
||||
pgMain.finalizeGLSLVertShaderObject(glVertex, context.code());
|
||||
pgMain.finalizeGLSLVertShaderObject(glVertex, context.id());
|
||||
}
|
||||
if (glFragment != 0) {
|
||||
pgMain.finalizeGLSLFragShaderObject(glFragment, context.code());
|
||||
pgMain.finalizeGLSLFragShaderObject(glFragment, context.id());
|
||||
}
|
||||
if (glProgram != 0) {
|
||||
pgMain.finalizeGLSLProgramObject(glProgram, context.code());
|
||||
pgMain.finalizeGLSLProgramObject(glProgram, context.id());
|
||||
}
|
||||
} finally {
|
||||
super.finalize();
|
||||
@@ -624,7 +624,7 @@ public class PShader {
|
||||
protected void init() {
|
||||
if (glProgram == 0 || contextIsOutdated()) {
|
||||
context = pgl.getCurrentContext();
|
||||
glProgram = pgMain.createGLSLProgramObject(context.code());
|
||||
glProgram = pgMain.createGLSLProgramObject(context.id());
|
||||
|
||||
boolean hasVert = false;
|
||||
if (vertexFilename != null) {
|
||||
@@ -688,9 +688,9 @@ public class PShader {
|
||||
protected boolean contextIsOutdated() {
|
||||
boolean outdated = !pgl.contextIsCurrent(context);
|
||||
if (outdated) {
|
||||
pgMain.removeGLSLProgramObject(glProgram, context.code());
|
||||
pgMain.removeGLSLVertShaderObject(glVertex, context.code());
|
||||
pgMain.removeGLSLFragShaderObject(glFragment, context.code());
|
||||
pgMain.removeGLSLProgramObject(glProgram, context.id());
|
||||
pgMain.removeGLSLVertShaderObject(glVertex, context.id());
|
||||
pgMain.removeGLSLFragShaderObject(glFragment, context.id());
|
||||
|
||||
glProgram = 0;
|
||||
glVertex = 0;
|
||||
@@ -760,7 +760,7 @@ public class PShader {
|
||||
* @param shaderSource a string containing the shader's code
|
||||
*/
|
||||
protected boolean compileVertexShader() {
|
||||
glVertex = pgMain.createGLSLVertShaderObject(context.code());
|
||||
glVertex = pgMain.createGLSLVertShaderObject(context.id());
|
||||
|
||||
pgl.shaderSource(glVertex, vertexShaderSource);
|
||||
pgl.compileShader(glVertex);
|
||||
@@ -781,7 +781,7 @@ public class PShader {
|
||||
* @param shaderSource a string containing the shader's code
|
||||
*/
|
||||
protected boolean compileFragmentShader() {
|
||||
glFragment = pgMain.createGLSLFragShaderObject(context.code());
|
||||
glFragment = pgMain.createGLSLFragShaderObject(context.id());
|
||||
|
||||
pgl.shaderSource(glFragment, fragmentShaderSource);
|
||||
pgl.compileShader(glFragment);
|
||||
@@ -810,15 +810,15 @@ public class PShader {
|
||||
|
||||
protected void release() {
|
||||
if (glVertex != 0) {
|
||||
pgMain.deleteGLSLVertShaderObject(glVertex, context.code());
|
||||
pgMain.deleteGLSLVertShaderObject(glVertex, context.id());
|
||||
glVertex = 0;
|
||||
}
|
||||
if (glFragment != 0) {
|
||||
pgMain.deleteGLSLFragShaderObject(glFragment, context.code());
|
||||
pgMain.deleteGLSLFragShaderObject(glFragment, context.id());
|
||||
glFragment = 0;
|
||||
}
|
||||
if (glProgram != 0) {
|
||||
pgMain.deleteGLSLProgramObject(glProgram, context.code());
|
||||
pgMain.deleteGLSLProgramObject(glProgram, context.id());
|
||||
glProgram = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -417,77 +417,77 @@ public class PShapeOpenGL extends PShape {
|
||||
|
||||
protected void finalizePolyBuffers() {
|
||||
if (glPolyVertex != 0) {
|
||||
pg.finalizeVertexBufferObject(glPolyVertex, context.code());
|
||||
pg.finalizeVertexBufferObject(glPolyVertex, context.id());
|
||||
}
|
||||
|
||||
if (glPolyColor != 0) {
|
||||
pg.finalizeVertexBufferObject(glPolyColor, context.code());
|
||||
pg.finalizeVertexBufferObject(glPolyColor, context.id());
|
||||
}
|
||||
|
||||
if (glPolyNormal != 0) {
|
||||
pg.finalizeVertexBufferObject(glPolyNormal, context.code());
|
||||
pg.finalizeVertexBufferObject(glPolyNormal, context.id());
|
||||
}
|
||||
|
||||
if (glPolyTexcoord != 0) {
|
||||
pg.finalizeVertexBufferObject(glPolyTexcoord, context.code());
|
||||
pg.finalizeVertexBufferObject(glPolyTexcoord, context.id());
|
||||
}
|
||||
|
||||
if (glPolyAmbient != 0) {
|
||||
pg.finalizeVertexBufferObject(glPolyAmbient, context.code());
|
||||
pg.finalizeVertexBufferObject(glPolyAmbient, context.id());
|
||||
}
|
||||
|
||||
if (glPolySpecular != 0) {
|
||||
pg.finalizeVertexBufferObject(glPolySpecular, context.code());
|
||||
pg.finalizeVertexBufferObject(glPolySpecular, context.id());
|
||||
}
|
||||
|
||||
if (glPolyEmissive != 0) {
|
||||
pg.finalizeVertexBufferObject(glPolyEmissive, context.code());
|
||||
pg.finalizeVertexBufferObject(glPolyEmissive, context.id());
|
||||
}
|
||||
|
||||
if (glPolyShininess != 0) {
|
||||
pg.finalizeVertexBufferObject(glPolyShininess, context.code());
|
||||
pg.finalizeVertexBufferObject(glPolyShininess, context.id());
|
||||
}
|
||||
|
||||
if (glPolyIndex != 0) {
|
||||
pg.finalizeVertexBufferObject(glPolyIndex, context.code());
|
||||
pg.finalizeVertexBufferObject(glPolyIndex, context.id());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void finalizeLineBuffers() {
|
||||
if (glLineVertex != 0) {
|
||||
pg.finalizeVertexBufferObject(glLineVertex, context.code());
|
||||
pg.finalizeVertexBufferObject(glLineVertex, context.id());
|
||||
}
|
||||
|
||||
if (glLineColor != 0) {
|
||||
pg.finalizeVertexBufferObject(glLineColor, context.code());
|
||||
pg.finalizeVertexBufferObject(glLineColor, context.id());
|
||||
}
|
||||
|
||||
if (glLineAttrib != 0) {
|
||||
pg.finalizeVertexBufferObject(glLineAttrib, context.code());
|
||||
pg.finalizeVertexBufferObject(glLineAttrib, context.id());
|
||||
}
|
||||
|
||||
if (glLineIndex != 0) {
|
||||
pg.finalizeVertexBufferObject(glLineIndex, context.code());
|
||||
pg.finalizeVertexBufferObject(glLineIndex, context.id());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void finalizePointBuffers() {
|
||||
if (glPointVertex != 0) {
|
||||
pg.finalizeVertexBufferObject(glPointVertex, context.code());
|
||||
pg.finalizeVertexBufferObject(glPointVertex, context.id());
|
||||
}
|
||||
|
||||
if (glPointColor != 0) {
|
||||
pg.finalizeVertexBufferObject(glPointColor, context.code());
|
||||
pg.finalizeVertexBufferObject(glPointColor, context.id());
|
||||
}
|
||||
|
||||
if (glPointAttrib != 0) {
|
||||
pg.finalizeVertexBufferObject(glPointAttrib, context.code());
|
||||
pg.finalizeVertexBufferObject(glPointAttrib, context.id());
|
||||
}
|
||||
|
||||
if (glPointIndex != 0) {
|
||||
pg.finalizeVertexBufferObject(glPointIndex, context.code());
|
||||
pg.finalizeVertexBufferObject(glPointIndex, context.id());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3237,49 +3237,49 @@ public class PShapeOpenGL extends PShape {
|
||||
int sizef = size * PGL.SIZEOF_FLOAT;
|
||||
int sizei = size * PGL.SIZEOF_INT;
|
||||
|
||||
glPolyVertex = pg.createVertexBufferObject(context.code());
|
||||
glPolyVertex = pg.createVertexBufferObject(context.id());
|
||||
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());
|
||||
glPolyColor = pg.createVertexBufferObject(context.id());
|
||||
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());
|
||||
glPolyNormal = pg.createVertexBufferObject(context.id());
|
||||
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());
|
||||
glPolyTexcoord = pg.createVertexBufferObject(context.id());
|
||||
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());
|
||||
glPolyAmbient = pg.createVertexBufferObject(context.id());
|
||||
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());
|
||||
glPolySpecular = pg.createVertexBufferObject(context.id());
|
||||
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());
|
||||
glPolyEmissive = pg.createVertexBufferObject(context.id());
|
||||
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());
|
||||
glPolyShininess = pg.createVertexBufferObject(context.id());
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyShininess);
|
||||
pgl.bufferData(PGL.ARRAY_BUFFER, sizef,
|
||||
FloatBuffer.wrap(tessGeo.polyShininess, 0, size),
|
||||
@@ -3287,7 +3287,7 @@ public class PShapeOpenGL extends PShape {
|
||||
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
|
||||
|
||||
glPolyIndex = pg.createVertexBufferObject(context.code());
|
||||
glPolyIndex = pg.createVertexBufferObject(context.id());
|
||||
pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, glPolyIndex);
|
||||
pgl.bufferData(PGL.ELEMENT_ARRAY_BUFFER,
|
||||
tessGeo.polyIndexCount * PGL.SIZEOF_INDEX,
|
||||
@@ -3303,19 +3303,19 @@ public class PShapeOpenGL extends PShape {
|
||||
int sizef = size * PGL.SIZEOF_FLOAT;
|
||||
int sizei = size * PGL.SIZEOF_INT;
|
||||
|
||||
glLineVertex = pg.createVertexBufferObject(context.code());
|
||||
glLineVertex = pg.createVertexBufferObject(context.id());
|
||||
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());
|
||||
glLineColor = pg.createVertexBufferObject(context.id());
|
||||
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());
|
||||
glLineAttrib = pg.createVertexBufferObject(context.id());
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, glLineAttrib);
|
||||
pgl.bufferData(PGL.ARRAY_BUFFER, 4 * sizef,
|
||||
FloatBuffer.wrap(tessGeo.lineAttribs, 0, 4 * size),
|
||||
@@ -3323,7 +3323,7 @@ public class PShapeOpenGL extends PShape {
|
||||
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
|
||||
|
||||
glLineIndex = pg.createVertexBufferObject(context.code());
|
||||
glLineIndex = pg.createVertexBufferObject(context.id());
|
||||
pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, glLineIndex);
|
||||
pgl.bufferData(PGL.ELEMENT_ARRAY_BUFFER,
|
||||
tessGeo.lineIndexCount * PGL.SIZEOF_INDEX,
|
||||
@@ -3339,19 +3339,19 @@ public class PShapeOpenGL extends PShape {
|
||||
int sizef = size * PGL.SIZEOF_FLOAT;
|
||||
int sizei = size * PGL.SIZEOF_INT;
|
||||
|
||||
glPointVertex = pg.createVertexBufferObject(context.code());
|
||||
glPointVertex = pg.createVertexBufferObject(context.id());
|
||||
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());
|
||||
glPointColor = pg.createVertexBufferObject(context.id());
|
||||
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());
|
||||
glPointAttrib = pg.createVertexBufferObject(context.id());
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPointAttrib);
|
||||
pgl.bufferData(PGL.ARRAY_BUFFER, 2 * sizef,
|
||||
FloatBuffer.wrap(tessGeo.pointAttribs, 0, 2 * size),
|
||||
@@ -3359,7 +3359,7 @@ public class PShapeOpenGL extends PShape {
|
||||
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
|
||||
|
||||
glPointIndex = pg.createVertexBufferObject(context.code());
|
||||
glPointIndex = pg.createVertexBufferObject(context.id());
|
||||
pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, glPointIndex);
|
||||
pgl.bufferData(PGL.ELEMENT_ARRAY_BUFFER,
|
||||
tessGeo.pointIndexCount * PGL.SIZEOF_INDEX,
|
||||
@@ -3377,25 +3377,25 @@ public class PShapeOpenGL extends PShape {
|
||||
// doesn't get deleted by OpenGL. The VBOs were already
|
||||
// automatically disposed when the old context was
|
||||
// destroyed.
|
||||
pg.removeVertexBufferObject(glPolyVertex, context.code());
|
||||
pg.removeVertexBufferObject(glPolyColor, context.code());
|
||||
pg.removeVertexBufferObject(glPolyNormal, context.code());
|
||||
pg.removeVertexBufferObject(glPolyTexcoord, context.code());
|
||||
pg.removeVertexBufferObject(glPolyAmbient, context.code());
|
||||
pg.removeVertexBufferObject(glPolySpecular, context.code());
|
||||
pg.removeVertexBufferObject(glPolyEmissive, context.code());
|
||||
pg.removeVertexBufferObject(glPolyShininess, context.code());
|
||||
pg.removeVertexBufferObject(glPolyIndex, context.code());
|
||||
pg.removeVertexBufferObject(glPolyVertex, context.id());
|
||||
pg.removeVertexBufferObject(glPolyColor, context.id());
|
||||
pg.removeVertexBufferObject(glPolyNormal, context.id());
|
||||
pg.removeVertexBufferObject(glPolyTexcoord, context.id());
|
||||
pg.removeVertexBufferObject(glPolyAmbient, context.id());
|
||||
pg.removeVertexBufferObject(glPolySpecular, context.id());
|
||||
pg.removeVertexBufferObject(glPolyEmissive, context.id());
|
||||
pg.removeVertexBufferObject(glPolyShininess, context.id());
|
||||
pg.removeVertexBufferObject(glPolyIndex, context.id());
|
||||
|
||||
pg.removeVertexBufferObject(glLineVertex, context.code());
|
||||
pg.removeVertexBufferObject(glLineColor, context.code());
|
||||
pg.removeVertexBufferObject(glLineAttrib, context.code());
|
||||
pg.removeVertexBufferObject(glLineIndex, context.code());
|
||||
pg.removeVertexBufferObject(glLineVertex, context.id());
|
||||
pg.removeVertexBufferObject(glLineColor, context.id());
|
||||
pg.removeVertexBufferObject(glLineAttrib, context.id());
|
||||
pg.removeVertexBufferObject(glLineIndex, context.id());
|
||||
|
||||
pg.removeVertexBufferObject(glPointVertex, context.code());
|
||||
pg.removeVertexBufferObject(glPointColor, context.code());
|
||||
pg.removeVertexBufferObject(glPointAttrib, context.code());
|
||||
pg.removeVertexBufferObject(glPointIndex, context.code());
|
||||
pg.removeVertexBufferObject(glPointVertex, context.id());
|
||||
pg.removeVertexBufferObject(glPointColor, context.id());
|
||||
pg.removeVertexBufferObject(glPointAttrib, context.id());
|
||||
pg.removeVertexBufferObject(glPointIndex, context.id());
|
||||
|
||||
// The OpenGL resources have been already deleted
|
||||
// when the context changed. We only need to zero
|
||||
@@ -3441,47 +3441,47 @@ public class PShapeOpenGL extends PShape {
|
||||
|
||||
protected void deletePolyBuffers() {
|
||||
if (glPolyVertex != 0) {
|
||||
pg.deleteVertexBufferObject(glPolyVertex, context.code());
|
||||
pg.deleteVertexBufferObject(glPolyVertex, context.id());
|
||||
glPolyVertex = 0;
|
||||
}
|
||||
|
||||
if (glPolyColor != 0) {
|
||||
pg.deleteVertexBufferObject(glPolyColor, context.code());
|
||||
pg.deleteVertexBufferObject(glPolyColor, context.id());
|
||||
glPolyColor = 0;
|
||||
}
|
||||
|
||||
if (glPolyNormal != 0) {
|
||||
pg.deleteVertexBufferObject(glPolyNormal, context.code());
|
||||
pg.deleteVertexBufferObject(glPolyNormal, context.id());
|
||||
glPolyNormal = 0;
|
||||
}
|
||||
|
||||
if (glPolyTexcoord != 0) {
|
||||
pg.deleteVertexBufferObject(glPolyTexcoord, context.code());
|
||||
pg.deleteVertexBufferObject(glPolyTexcoord, context.id());
|
||||
glPolyTexcoord = 0;
|
||||
}
|
||||
|
||||
if (glPolyAmbient != 0) {
|
||||
pg.deleteVertexBufferObject(glPolyAmbient, context.code());
|
||||
pg.deleteVertexBufferObject(glPolyAmbient, context.id());
|
||||
glPolyAmbient = 0;
|
||||
}
|
||||
|
||||
if (glPolySpecular != 0) {
|
||||
pg.deleteVertexBufferObject(glPolySpecular, context.code());
|
||||
pg.deleteVertexBufferObject(glPolySpecular, context.id());
|
||||
glPolySpecular = 0;
|
||||
}
|
||||
|
||||
if (glPolyEmissive != 0) {
|
||||
pg.deleteVertexBufferObject(glPolyEmissive, context.code());
|
||||
pg.deleteVertexBufferObject(glPolyEmissive, context.id());
|
||||
glPolyEmissive = 0;
|
||||
}
|
||||
|
||||
if (glPolyShininess != 0) {
|
||||
pg.deleteVertexBufferObject(glPolyShininess, context.code());
|
||||
pg.deleteVertexBufferObject(glPolyShininess, context.id());
|
||||
glPolyShininess = 0;
|
||||
}
|
||||
|
||||
if (glPolyIndex != 0) {
|
||||
pg.deleteVertexBufferObject(glPolyIndex, context.code());
|
||||
pg.deleteVertexBufferObject(glPolyIndex, context.id());
|
||||
glPolyIndex = 0;
|
||||
}
|
||||
}
|
||||
@@ -3489,22 +3489,22 @@ public class PShapeOpenGL extends PShape {
|
||||
|
||||
protected void deleteLineBuffers() {
|
||||
if (glLineVertex != 0) {
|
||||
pg.deleteVertexBufferObject(glLineVertex, context.code());
|
||||
pg.deleteVertexBufferObject(glLineVertex, context.id());
|
||||
glLineVertex = 0;
|
||||
}
|
||||
|
||||
if (glLineColor != 0) {
|
||||
pg.deleteVertexBufferObject(glLineColor, context.code());
|
||||
pg.deleteVertexBufferObject(glLineColor, context.id());
|
||||
glLineColor = 0;
|
||||
}
|
||||
|
||||
if (glLineAttrib != 0) {
|
||||
pg.deleteVertexBufferObject(glLineAttrib, context.code());
|
||||
pg.deleteVertexBufferObject(glLineAttrib, context.id());
|
||||
glLineAttrib = 0;
|
||||
}
|
||||
|
||||
if (glLineIndex != 0) {
|
||||
pg.deleteVertexBufferObject(glLineIndex, context.code());
|
||||
pg.deleteVertexBufferObject(glLineIndex, context.id());
|
||||
glLineIndex = 0;
|
||||
}
|
||||
}
|
||||
@@ -3512,22 +3512,22 @@ public class PShapeOpenGL extends PShape {
|
||||
|
||||
protected void deletePointBuffers() {
|
||||
if (glPointVertex != 0) {
|
||||
pg.deleteVertexBufferObject(glPointVertex, context.code());
|
||||
pg.deleteVertexBufferObject(glPointVertex, context.id());
|
||||
glPointVertex = 0;
|
||||
}
|
||||
|
||||
if (glPointColor != 0) {
|
||||
pg.deleteVertexBufferObject(glPointColor, context.code());
|
||||
pg.deleteVertexBufferObject(glPointColor, context.id());
|
||||
glPointColor = 0;
|
||||
}
|
||||
|
||||
if (glPointAttrib != 0) {
|
||||
pg.deleteVertexBufferObject(glPointAttrib, context.code());
|
||||
pg.deleteVertexBufferObject(glPointAttrib, context.id());
|
||||
glPointAttrib = 0;
|
||||
}
|
||||
|
||||
if (glPointIndex != 0) {
|
||||
pg.deleteVertexBufferObject(glPointIndex, context.code());
|
||||
pg.deleteVertexBufferObject(glPointIndex, context.id());
|
||||
glPointIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ public class Texture implements PConstants {
|
||||
protected void finalize() throws Throwable {
|
||||
try {
|
||||
if (glName != 0) {
|
||||
pg.finalizeTextureObject(glName, context.code());
|
||||
pg.finalizeTextureObject(glName, context.id());
|
||||
}
|
||||
} finally {
|
||||
super.finalize();
|
||||
@@ -1129,7 +1129,7 @@ public class Texture implements PConstants {
|
||||
}
|
||||
|
||||
context = pgl.getCurrentContext();
|
||||
glName = pg.createTextureObject(context.code());
|
||||
glName = pg.createTextureObject(context.id());
|
||||
|
||||
pgl.bindTexture(glTarget, glName);
|
||||
pgl.texParameteri(glTarget, PGL.TEXTURE_MIN_FILTER, glMinFilter);
|
||||
@@ -1160,7 +1160,7 @@ public class Texture implements PConstants {
|
||||
*/
|
||||
protected void release() {
|
||||
if (glName != 0) {
|
||||
pg.finalizeTextureObject(glName, context.code());
|
||||
pg.finalizeTextureObject(glName, context.id());
|
||||
glName = 0;
|
||||
}
|
||||
}
|
||||
@@ -1172,7 +1172,7 @@ public class Texture implements PConstants {
|
||||
// Removing the texture object from the renderer's list so it
|
||||
// doesn't get deleted by OpenGL. The texture object was
|
||||
// automatically disposed when the old context was destroyed.
|
||||
pg.removeTextureObject(glName, context.code());
|
||||
pg.removeTextureObject(glName, context.id());
|
||||
|
||||
// And then set the id to zero, so it doesn't try to be
|
||||
// deleted when the object's finalizer is invoked by the GC.
|
||||
|
||||
+2
-2
@@ -25,13 +25,13 @@ X http://code.google.com/p/processing/issues/detail?id=1192
|
||||
0208 android
|
||||
X Issues on low-end phones:
|
||||
X http://code.google.com/p/processing/issues/detail?id=1145
|
||||
X Rotation problem on Android:
|
||||
X http://code.google.com/p/processing/issues/detail?id=1146
|
||||
|
||||
|
||||
0208 todo pre-beta:
|
||||
_ Back-buffer support in shaders:
|
||||
_ http://code.google.com/p/processing/issues/detail?id=1169
|
||||
_ Rotation problem on Android:
|
||||
_ http://code.google.com/p/processing/issues/detail?id=1146
|
||||
_ Decide on the names of the uniform and attribute variables in the shaders
|
||||
|
||||
|
||||
|
||||
@@ -146,19 +146,19 @@ public class FrameBuffer implements PConstants {
|
||||
protected void finalize() throws Throwable {
|
||||
try {
|
||||
if (glFbo != 0) {
|
||||
pg.finalizeFrameBufferObject(glFbo, context.code());
|
||||
pg.finalizeFrameBufferObject(glFbo, context.id());
|
||||
}
|
||||
if (glDepth != 0) {
|
||||
pg.finalizeRenderBufferObject(glDepth, context.code());
|
||||
pg.finalizeRenderBufferObject(glDepth, context.id());
|
||||
}
|
||||
if (glStencil != 0) {
|
||||
pg.finalizeRenderBufferObject(glStencil, context.code());
|
||||
pg.finalizeRenderBufferObject(glStencil, context.id());
|
||||
}
|
||||
if (glMultisample != 0) {
|
||||
pg.finalizeRenderBufferObject(glMultisample, context.code());
|
||||
pg.finalizeRenderBufferObject(glMultisample, context.id());
|
||||
}
|
||||
if (glDepthStencil != 0) {
|
||||
pg.finalizeRenderBufferObject(glDepthStencil, context.code());
|
||||
pg.finalizeRenderBufferObject(glDepthStencil, context.id());
|
||||
}
|
||||
} finally {
|
||||
super.finalize();
|
||||
@@ -291,7 +291,7 @@ public class FrameBuffer implements PConstants {
|
||||
if (screenFb) {
|
||||
glFbo = 0;
|
||||
} else {
|
||||
glFbo = pg.createFrameBufferObject(context.code());
|
||||
glFbo = pg.createFrameBufferObject(context.id());
|
||||
}
|
||||
|
||||
// create the rest of the stuff...
|
||||
@@ -314,23 +314,23 @@ public class FrameBuffer implements PConstants {
|
||||
|
||||
protected void release() {
|
||||
if (glFbo != 0) {
|
||||
pg.finalizeFrameBufferObject(glFbo, context.code());
|
||||
pg.finalizeFrameBufferObject(glFbo, context.id());
|
||||
glFbo = 0;
|
||||
}
|
||||
if (glDepth != 0) {
|
||||
pg.finalizeRenderBufferObject(glDepth, context.code());
|
||||
pg.finalizeRenderBufferObject(glDepth, context.id());
|
||||
glDepth = 0;
|
||||
}
|
||||
if (glStencil != 0) {
|
||||
pg.finalizeRenderBufferObject(glStencil, context.code());
|
||||
pg.finalizeRenderBufferObject(glStencil, context.id());
|
||||
glStencil = 0;
|
||||
}
|
||||
if (glMultisample != 0) {
|
||||
pg.finalizeRenderBufferObject(glMultisample, context.code());
|
||||
pg.finalizeRenderBufferObject(glMultisample, context.id());
|
||||
glMultisample = 0;
|
||||
}
|
||||
if (glDepthStencil != 0) {
|
||||
pg.finalizeRenderBufferObject(glDepthStencil, context.code());
|
||||
pg.finalizeRenderBufferObject(glDepthStencil, context.id());
|
||||
glDepthStencil = 0;
|
||||
}
|
||||
}
|
||||
@@ -339,11 +339,11 @@ public class FrameBuffer implements PConstants {
|
||||
protected boolean contextIsOutdated() {
|
||||
boolean outdated = !pgl.contextIsCurrent(context);
|
||||
if (outdated) {
|
||||
pg.removeFrameBufferObject(glFbo, context.code());
|
||||
pg.removeRenderBufferObject(glDepth, context.code());
|
||||
pg.removeRenderBufferObject(glStencil, context.code());
|
||||
pg.removeRenderBufferObject(glDepthStencil, context.code());
|
||||
pg.removeRenderBufferObject(glMultisample, context.code());
|
||||
pg.removeFrameBufferObject(glFbo, context.id());
|
||||
pg.removeRenderBufferObject(glDepth, context.id());
|
||||
pg.removeRenderBufferObject(glStencil, context.id());
|
||||
pg.removeRenderBufferObject(glDepthStencil, context.id());
|
||||
pg.removeRenderBufferObject(glMultisample, context.id());
|
||||
|
||||
glFbo = 0;
|
||||
glDepth = 0;
|
||||
@@ -365,7 +365,7 @@ public class FrameBuffer implements PConstants {
|
||||
pg.pushFramebuffer();
|
||||
pg.setFramebuffer(this);
|
||||
|
||||
glMultisample = pg.createRenderBufferObject(context.code());
|
||||
glMultisample = pg.createRenderBufferObject(context.id());
|
||||
pgl.bindRenderbuffer(PGL.RENDERBUFFER, glMultisample);
|
||||
pgl.renderbufferStorageMultisample(PGL.RENDERBUFFER, nsamples,
|
||||
PGL.RGBA8, width, height);
|
||||
@@ -386,7 +386,7 @@ public class FrameBuffer implements PConstants {
|
||||
pg.pushFramebuffer();
|
||||
pg.setFramebuffer(this);
|
||||
|
||||
glDepthStencil = pg.createRenderBufferObject(context.code());
|
||||
glDepthStencil = pg.createRenderBufferObject(context.id());
|
||||
pgl.bindRenderbuffer(PGL.RENDERBUFFER, glDepthStencil);
|
||||
|
||||
if (multisample) {
|
||||
@@ -416,7 +416,7 @@ public class FrameBuffer implements PConstants {
|
||||
pg.pushFramebuffer();
|
||||
pg.setFramebuffer(this);
|
||||
|
||||
glDepth = pg.createRenderBufferObject(context.code());
|
||||
glDepth = pg.createRenderBufferObject(context.id());
|
||||
pgl.bindRenderbuffer(PGL.RENDERBUFFER, glDepth);
|
||||
|
||||
int glConst = PGL.DEPTH_COMPONENT16;
|
||||
@@ -452,7 +452,7 @@ public class FrameBuffer implements PConstants {
|
||||
pg.pushFramebuffer();
|
||||
pg.setFramebuffer(this);
|
||||
|
||||
glStencil = pg.createRenderBufferObject(context.code());
|
||||
glStencil = pg.createRenderBufferObject(context.id());
|
||||
pgl.bindRenderbuffer(PGL.RENDERBUFFER, glStencil);
|
||||
|
||||
int glConst = PGL.STENCIL_INDEX1;
|
||||
|
||||
@@ -249,7 +249,7 @@ class PFontTexture implements PConstants {
|
||||
}
|
||||
if (outdated) {
|
||||
for (int i = 0; i < textures.length; i++) {
|
||||
pg.removeTextureObject(textures[i].glName, textures[i].context.code());
|
||||
pg.removeTextureObject(textures[i].glName, textures[i].context.id());
|
||||
textures[i].glName = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ public class PGL {
|
||||
"precision mediump int;\n" +
|
||||
"#endif\n";
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
// OpenGL constants
|
||||
|
||||
@@ -1626,14 +1626,18 @@ public class PGL {
|
||||
|
||||
|
||||
protected class Context {
|
||||
protected GLContext glContext;
|
||||
protected int id;
|
||||
|
||||
Context() {
|
||||
glContext = null;
|
||||
id = -1;
|
||||
}
|
||||
|
||||
Context(GLContext context) {
|
||||
glContext = context;
|
||||
if (context != null) {
|
||||
id = context.hashCode();
|
||||
} else {
|
||||
id = -1;
|
||||
}
|
||||
}
|
||||
|
||||
boolean current() {
|
||||
@@ -1641,21 +1645,17 @@ public class PGL {
|
||||
}
|
||||
|
||||
boolean equal(GLContext context) {
|
||||
if (glContext == null || context == null) {
|
||||
if (id == -1 || context == null) {
|
||||
// A null context means a still non-created resource,
|
||||
// so it is considered equal to the argument.
|
||||
return true;
|
||||
} else {
|
||||
return glContext.hashCode() == context.hashCode();
|
||||
return id == context.hashCode();
|
||||
}
|
||||
}
|
||||
|
||||
int code() {
|
||||
if (glContext == null) {
|
||||
return -1;
|
||||
} else {
|
||||
return glContext.hashCode();
|
||||
}
|
||||
int id() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1168,45 +1168,45 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
int sizei = INIT_VERTEX_BUFFER_SIZE * PGL.SIZEOF_INT;
|
||||
int sizex = INIT_INDEX_BUFFER_SIZE * PGL.SIZEOF_INDEX;
|
||||
|
||||
glPolyVertex = createVertexBufferObject(polyBuffersContext.code());
|
||||
glPolyVertex = createVertexBufferObject(polyBuffersContext.id());
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyVertex);
|
||||
pgl.bufferData(PGL.ARRAY_BUFFER, 3 * sizef, null, PGL.STATIC_DRAW);
|
||||
|
||||
glPolyColor = createVertexBufferObject(polyBuffersContext.code());
|
||||
glPolyColor = createVertexBufferObject(polyBuffersContext.id());
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyColor);
|
||||
pgl.bufferData(PGL.ARRAY_BUFFER, sizei, null, PGL.STATIC_DRAW);
|
||||
|
||||
glPolyNormal = createVertexBufferObject(polyBuffersContext.code());
|
||||
glPolyNormal = createVertexBufferObject(polyBuffersContext.id());
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyNormal);
|
||||
pgl.bufferData(PGL.ARRAY_BUFFER, 3 * sizef, null, PGL.STATIC_DRAW);
|
||||
|
||||
glPolyTexcoord = createVertexBufferObject(polyBuffersContext.code());
|
||||
glPolyTexcoord = createVertexBufferObject(polyBuffersContext.id());
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyTexcoord);
|
||||
pgl.bufferData(PGL.ARRAY_BUFFER, 2 * sizef, null, PGL.STATIC_DRAW);
|
||||
|
||||
glPolyAmbient = pgPrimary.createVertexBufferObject(
|
||||
polyBuffersContext.code());
|
||||
polyBuffersContext.id());
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyAmbient);
|
||||
pgl.bufferData(PGL.ARRAY_BUFFER, sizei, null, PGL.STATIC_DRAW);
|
||||
|
||||
glPolySpecular = pgPrimary.createVertexBufferObject(
|
||||
polyBuffersContext.code());
|
||||
polyBuffersContext.id());
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolySpecular);
|
||||
pgl.bufferData(PGL.ARRAY_BUFFER, sizei, null, PGL.STATIC_DRAW);
|
||||
|
||||
glPolyEmissive = pgPrimary.createVertexBufferObject(
|
||||
polyBuffersContext.code());
|
||||
polyBuffersContext.id());
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyEmissive);
|
||||
pgl.bufferData(PGL.ARRAY_BUFFER, sizei, null, PGL.STATIC_DRAW);
|
||||
|
||||
glPolyShininess = pgPrimary.createVertexBufferObject(
|
||||
polyBuffersContext.code());
|
||||
polyBuffersContext.id());
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyShininess);
|
||||
pgl.bufferData(PGL.ARRAY_BUFFER, sizef, null, PGL.STATIC_DRAW);
|
||||
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
|
||||
|
||||
glPolyIndex = createVertexBufferObject(polyBuffersContext.code());
|
||||
glPolyIndex = createVertexBufferObject(polyBuffersContext.id());
|
||||
pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, glPolyIndex);
|
||||
pgl.bufferData(PGL.ELEMENT_ARRAY_BUFFER, sizex, null, PGL.STATIC_DRAW);
|
||||
|
||||
@@ -1281,31 +1281,31 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
|
||||
protected void deletePolyBuffers() {
|
||||
if (polyBuffersCreated) {
|
||||
deleteVertexBufferObject(glPolyVertex, polyBuffersContext.code());
|
||||
deleteVertexBufferObject(glPolyVertex, polyBuffersContext.id());
|
||||
glPolyVertex = 0;
|
||||
|
||||
deleteVertexBufferObject(glPolyColor, polyBuffersContext.code());
|
||||
deleteVertexBufferObject(glPolyColor, polyBuffersContext.id());
|
||||
glPolyColor = 0;
|
||||
|
||||
deleteVertexBufferObject(glPolyNormal, polyBuffersContext.code());
|
||||
deleteVertexBufferObject(glPolyNormal, polyBuffersContext.id());
|
||||
glPolyNormal = 0;
|
||||
|
||||
deleteVertexBufferObject(glPolyTexcoord, polyBuffersContext.code());
|
||||
deleteVertexBufferObject(glPolyTexcoord, polyBuffersContext.id());
|
||||
glPolyTexcoord = 0;
|
||||
|
||||
deleteVertexBufferObject(glPolyAmbient, polyBuffersContext.code());
|
||||
deleteVertexBufferObject(glPolyAmbient, polyBuffersContext.id());
|
||||
glPolyAmbient = 0;
|
||||
|
||||
deleteVertexBufferObject(glPolySpecular, polyBuffersContext.code());
|
||||
deleteVertexBufferObject(glPolySpecular, polyBuffersContext.id());
|
||||
glPolySpecular = 0;
|
||||
|
||||
deleteVertexBufferObject(glPolyEmissive, polyBuffersContext.code());
|
||||
deleteVertexBufferObject(glPolyEmissive, polyBuffersContext.id());
|
||||
glPolyEmissive = 0;
|
||||
|
||||
deleteVertexBufferObject(glPolyShininess, polyBuffersContext.code());
|
||||
deleteVertexBufferObject(glPolyShininess, polyBuffersContext.id());
|
||||
glPolyShininess = 0;
|
||||
|
||||
deleteVertexBufferObject(glPolyIndex, polyBuffersContext.code());
|
||||
deleteVertexBufferObject(glPolyIndex, polyBuffersContext.id());
|
||||
glPolyIndex = 0;
|
||||
|
||||
polyBuffersCreated = false;
|
||||
@@ -1321,22 +1321,22 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
int sizei = INIT_VERTEX_BUFFER_SIZE * PGL.SIZEOF_INT;
|
||||
int sizex = INIT_INDEX_BUFFER_SIZE * PGL.SIZEOF_INDEX;
|
||||
|
||||
glLineVertex = createVertexBufferObject(lineBuffersContext.code());
|
||||
glLineVertex = createVertexBufferObject(lineBuffersContext.id());
|
||||
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, glLineVertex);
|
||||
pgl.bufferData(PGL.ARRAY_BUFFER, 3 * sizef, null, PGL.STATIC_DRAW);
|
||||
|
||||
glLineColor = createVertexBufferObject(lineBuffersContext.code());
|
||||
glLineColor = createVertexBufferObject(lineBuffersContext.id());
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, glLineColor);
|
||||
pgl.bufferData(PGL.ARRAY_BUFFER, sizei, null, PGL.STATIC_DRAW);
|
||||
|
||||
glLineAttrib = createVertexBufferObject(lineBuffersContext.code());
|
||||
glLineAttrib = createVertexBufferObject(lineBuffersContext.id());
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, glLineAttrib);
|
||||
pgl.bufferData(PGL.ARRAY_BUFFER, 4 * sizef, null, PGL.STATIC_DRAW);
|
||||
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
|
||||
|
||||
glLineIndex = createVertexBufferObject(lineBuffersContext.code());
|
||||
glLineIndex = createVertexBufferObject(lineBuffersContext.id());
|
||||
pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, glLineIndex);
|
||||
pgl.bufferData(PGL.ELEMENT_ARRAY_BUFFER, sizex, null, PGL.STATIC_DRAW);
|
||||
|
||||
@@ -1387,16 +1387,16 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
|
||||
protected void deleteLineBuffers() {
|
||||
if (lineBuffersCreated) {
|
||||
deleteVertexBufferObject(glLineVertex, lineBuffersContext.code());
|
||||
deleteVertexBufferObject(glLineVertex, lineBuffersContext.id());
|
||||
glLineVertex = 0;
|
||||
|
||||
deleteVertexBufferObject(glLineColor, lineBuffersContext.code());
|
||||
deleteVertexBufferObject(glLineColor, lineBuffersContext.id());
|
||||
glLineColor = 0;
|
||||
|
||||
deleteVertexBufferObject(glLineAttrib, lineBuffersContext.code());
|
||||
deleteVertexBufferObject(glLineAttrib, lineBuffersContext.id());
|
||||
glLineAttrib = 0;
|
||||
|
||||
deleteVertexBufferObject(glLineIndex, lineBuffersContext.code());
|
||||
deleteVertexBufferObject(glLineIndex, lineBuffersContext.id());
|
||||
glLineIndex = 0;
|
||||
|
||||
lineBuffersCreated = false;
|
||||
@@ -1412,21 +1412,21 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
int sizei = INIT_VERTEX_BUFFER_SIZE * PGL.SIZEOF_INT;
|
||||
int sizex = INIT_INDEX_BUFFER_SIZE * PGL.SIZEOF_INDEX;
|
||||
|
||||
glPointVertex = createVertexBufferObject(pointBuffersContext.code());
|
||||
glPointVertex = createVertexBufferObject(pointBuffersContext.id());
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPointVertex);
|
||||
pgl.bufferData(PGL.ARRAY_BUFFER, 3 * sizef, null, PGL.STATIC_DRAW);
|
||||
|
||||
glPointColor = createVertexBufferObject(pointBuffersContext.code());
|
||||
glPointColor = createVertexBufferObject(pointBuffersContext.id());
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPointColor);
|
||||
pgl.bufferData(PGL.ARRAY_BUFFER, sizei, null, PGL.STATIC_DRAW);
|
||||
|
||||
glPointAttrib = createVertexBufferObject(pointBuffersContext.code());
|
||||
glPointAttrib = createVertexBufferObject(pointBuffersContext.id());
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPointAttrib);
|
||||
pgl.bufferData(PGL.ARRAY_BUFFER, 2 * sizef, null, PGL.STATIC_DRAW);
|
||||
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
|
||||
|
||||
glPointIndex = createVertexBufferObject(pointBuffersContext.code());
|
||||
glPointIndex = createVertexBufferObject(pointBuffersContext.id());
|
||||
pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, glPointIndex);
|
||||
pgl.bufferData(PGL.ELEMENT_ARRAY_BUFFER, sizex, null, PGL.STATIC_DRAW);
|
||||
|
||||
@@ -1477,16 +1477,16 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
|
||||
protected void deletePointBuffers() {
|
||||
if (pointBuffersCreated) {
|
||||
deleteVertexBufferObject(glPointVertex, pointBuffersContext.code());
|
||||
deleteVertexBufferObject(glPointVertex, pointBuffersContext.id());
|
||||
glPointVertex = 0;
|
||||
|
||||
deleteVertexBufferObject(glPointColor, pointBuffersContext.code());
|
||||
deleteVertexBufferObject(glPointColor, pointBuffersContext.id());
|
||||
glPointColor = 0;
|
||||
|
||||
deleteVertexBufferObject(glPointAttrib, pointBuffersContext.code());
|
||||
deleteVertexBufferObject(glPointAttrib, pointBuffersContext.id());
|
||||
glPointAttrib = 0;
|
||||
|
||||
deleteVertexBufferObject(glPointIndex, pointBuffersContext.code());
|
||||
deleteVertexBufferObject(glPointIndex, pointBuffersContext.id());
|
||||
glPointIndex = 0;
|
||||
|
||||
pointBuffersCreated = false;
|
||||
|
||||
@@ -152,13 +152,13 @@ public class PShader {
|
||||
protected void finalize() throws Throwable {
|
||||
try {
|
||||
if (glVertex != 0) {
|
||||
pgMain.finalizeGLSLVertShaderObject(glVertex, context.code());
|
||||
pgMain.finalizeGLSLVertShaderObject(glVertex, context.id());
|
||||
}
|
||||
if (glFragment != 0) {
|
||||
pgMain.finalizeGLSLFragShaderObject(glFragment, context.code());
|
||||
pgMain.finalizeGLSLFragShaderObject(glFragment, context.id());
|
||||
}
|
||||
if (glProgram != 0) {
|
||||
pgMain.finalizeGLSLProgramObject(glProgram, context.code());
|
||||
pgMain.finalizeGLSLProgramObject(glProgram, context.id());
|
||||
}
|
||||
} finally {
|
||||
super.finalize();
|
||||
@@ -625,7 +625,7 @@ public class PShader {
|
||||
protected void init() {
|
||||
if (glProgram == 0 || contextIsOutdated()) {
|
||||
context = pgl.getCurrentContext();
|
||||
glProgram = pgMain.createGLSLProgramObject(context.code());
|
||||
glProgram = pgMain.createGLSLProgramObject(context.id());
|
||||
|
||||
boolean hasVert = false;
|
||||
if (vertexFilename != null) {
|
||||
@@ -689,9 +689,9 @@ public class PShader {
|
||||
protected boolean contextIsOutdated() {
|
||||
boolean outdated = !pgl.contextIsCurrent(context);
|
||||
if (outdated) {
|
||||
pgMain.removeGLSLProgramObject(glProgram, context.code());
|
||||
pgMain.removeGLSLVertShaderObject(glVertex, context.code());
|
||||
pgMain.removeGLSLFragShaderObject(glFragment, context.code());
|
||||
pgMain.removeGLSLProgramObject(glProgram, context.id());
|
||||
pgMain.removeGLSLVertShaderObject(glVertex, context.id());
|
||||
pgMain.removeGLSLFragShaderObject(glFragment, context.id());
|
||||
|
||||
glProgram = 0;
|
||||
glVertex = 0;
|
||||
@@ -761,7 +761,7 @@ public class PShader {
|
||||
* @param shaderSource a string containing the shader's code
|
||||
*/
|
||||
protected boolean compileVertexShader() {
|
||||
glVertex = pgMain.createGLSLVertShaderObject(context.code());
|
||||
glVertex = pgMain.createGLSLVertShaderObject(context.id());
|
||||
|
||||
pgl.shaderSource(glVertex, vertexShaderSource);
|
||||
pgl.compileShader(glVertex);
|
||||
@@ -782,7 +782,7 @@ public class PShader {
|
||||
* @param shaderSource a string containing the shader's code
|
||||
*/
|
||||
protected boolean compileFragmentShader() {
|
||||
glFragment = pgMain.createGLSLFragShaderObject(context.code());
|
||||
glFragment = pgMain.createGLSLFragShaderObject(context.id());
|
||||
|
||||
pgl.shaderSource(glFragment, fragmentShaderSource);
|
||||
pgl.compileShader(glFragment);
|
||||
@@ -811,15 +811,15 @@ public class PShader {
|
||||
|
||||
protected void release() {
|
||||
if (glVertex != 0) {
|
||||
pgMain.deleteGLSLVertShaderObject(glVertex, context.code());
|
||||
pgMain.deleteGLSLVertShaderObject(glVertex, context.id());
|
||||
glVertex = 0;
|
||||
}
|
||||
if (glFragment != 0) {
|
||||
pgMain.deleteGLSLFragShaderObject(glFragment, context.code());
|
||||
pgMain.deleteGLSLFragShaderObject(glFragment, context.id());
|
||||
glFragment = 0;
|
||||
}
|
||||
if (glProgram != 0) {
|
||||
pgMain.deleteGLSLProgramObject(glProgram, context.code());
|
||||
pgMain.deleteGLSLProgramObject(glProgram, context.id());
|
||||
glProgram = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -419,77 +419,77 @@ public class PShapeOpenGL extends PShape {
|
||||
|
||||
protected void finalizePolyBuffers() {
|
||||
if (glPolyVertex != 0) {
|
||||
pg.finalizeVertexBufferObject(glPolyVertex, context.code());
|
||||
pg.finalizeVertexBufferObject(glPolyVertex, context.id());
|
||||
}
|
||||
|
||||
if (glPolyColor != 0) {
|
||||
pg.finalizeVertexBufferObject(glPolyColor, context.code());
|
||||
pg.finalizeVertexBufferObject(glPolyColor, context.id());
|
||||
}
|
||||
|
||||
if (glPolyNormal != 0) {
|
||||
pg.finalizeVertexBufferObject(glPolyNormal, context.code());
|
||||
pg.finalizeVertexBufferObject(glPolyNormal, context.id());
|
||||
}
|
||||
|
||||
if (glPolyTexcoord != 0) {
|
||||
pg.finalizeVertexBufferObject(glPolyTexcoord, context.code());
|
||||
pg.finalizeVertexBufferObject(glPolyTexcoord, context.id());
|
||||
}
|
||||
|
||||
if (glPolyAmbient != 0) {
|
||||
pg.finalizeVertexBufferObject(glPolyAmbient, context.code());
|
||||
pg.finalizeVertexBufferObject(glPolyAmbient, context.id());
|
||||
}
|
||||
|
||||
if (glPolySpecular != 0) {
|
||||
pg.finalizeVertexBufferObject(glPolySpecular, context.code());
|
||||
pg.finalizeVertexBufferObject(glPolySpecular, context.id());
|
||||
}
|
||||
|
||||
if (glPolyEmissive != 0) {
|
||||
pg.finalizeVertexBufferObject(glPolyEmissive, context.code());
|
||||
pg.finalizeVertexBufferObject(glPolyEmissive, context.id());
|
||||
}
|
||||
|
||||
if (glPolyShininess != 0) {
|
||||
pg.finalizeVertexBufferObject(glPolyShininess, context.code());
|
||||
pg.finalizeVertexBufferObject(glPolyShininess, context.id());
|
||||
}
|
||||
|
||||
if (glPolyIndex != 0) {
|
||||
pg.finalizeVertexBufferObject(glPolyIndex, context.code());
|
||||
pg.finalizeVertexBufferObject(glPolyIndex, context.id());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void finalizeLineBuffers() {
|
||||
if (glLineVertex != 0) {
|
||||
pg.finalizeVertexBufferObject(glLineVertex, context.code());
|
||||
pg.finalizeVertexBufferObject(glLineVertex, context.id());
|
||||
}
|
||||
|
||||
if (glLineColor != 0) {
|
||||
pg.finalizeVertexBufferObject(glLineColor, context.code());
|
||||
pg.finalizeVertexBufferObject(glLineColor, context.id());
|
||||
}
|
||||
|
||||
if (glLineAttrib != 0) {
|
||||
pg.finalizeVertexBufferObject(glLineAttrib, context.code());
|
||||
pg.finalizeVertexBufferObject(glLineAttrib, context.id());
|
||||
}
|
||||
|
||||
if (glLineIndex != 0) {
|
||||
pg.finalizeVertexBufferObject(glLineIndex, context.code());
|
||||
pg.finalizeVertexBufferObject(glLineIndex, context.id());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void finalizePointBuffers() {
|
||||
if (glPointVertex != 0) {
|
||||
pg.finalizeVertexBufferObject(glPointVertex, context.code());
|
||||
pg.finalizeVertexBufferObject(glPointVertex, context.id());
|
||||
}
|
||||
|
||||
if (glPointColor != 0) {
|
||||
pg.finalizeVertexBufferObject(glPointColor, context.code());
|
||||
pg.finalizeVertexBufferObject(glPointColor, context.id());
|
||||
}
|
||||
|
||||
if (glPointAttrib != 0) {
|
||||
pg.finalizeVertexBufferObject(glPointAttrib, context.code());
|
||||
pg.finalizeVertexBufferObject(glPointAttrib, context.id());
|
||||
}
|
||||
|
||||
if (glPointIndex != 0) {
|
||||
pg.finalizeVertexBufferObject(glPointIndex, context.code());
|
||||
pg.finalizeVertexBufferObject(glPointIndex, context.id());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3345,49 +3345,49 @@ public class PShapeOpenGL extends PShape {
|
||||
int sizef = size * PGL.SIZEOF_FLOAT;
|
||||
int sizei = size * PGL.SIZEOF_INT;
|
||||
|
||||
glPolyVertex = pg.createVertexBufferObject(context.code());
|
||||
glPolyVertex = pg.createVertexBufferObject(context.id());
|
||||
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());
|
||||
glPolyColor = pg.createVertexBufferObject(context.id());
|
||||
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());
|
||||
glPolyNormal = pg.createVertexBufferObject(context.id());
|
||||
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());
|
||||
glPolyTexcoord = pg.createVertexBufferObject(context.id());
|
||||
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());
|
||||
glPolyAmbient = pg.createVertexBufferObject(context.id());
|
||||
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());
|
||||
glPolySpecular = pg.createVertexBufferObject(context.id());
|
||||
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());
|
||||
glPolyEmissive = pg.createVertexBufferObject(context.id());
|
||||
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());
|
||||
glPolyShininess = pg.createVertexBufferObject(context.id());
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyShininess);
|
||||
pgl.bufferData(PGL.ARRAY_BUFFER, sizef,
|
||||
FloatBuffer.wrap(tessGeo.polyShininess, 0, size),
|
||||
@@ -3395,7 +3395,7 @@ public class PShapeOpenGL extends PShape {
|
||||
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
|
||||
|
||||
glPolyIndex = pg.createVertexBufferObject(context.code());
|
||||
glPolyIndex = pg.createVertexBufferObject(context.id());
|
||||
pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, glPolyIndex);
|
||||
pgl.bufferData(PGL.ELEMENT_ARRAY_BUFFER,
|
||||
tessGeo.polyIndexCount * PGL.SIZEOF_INDEX,
|
||||
@@ -3411,19 +3411,19 @@ public class PShapeOpenGL extends PShape {
|
||||
int sizef = size * PGL.SIZEOF_FLOAT;
|
||||
int sizei = size * PGL.SIZEOF_INT;
|
||||
|
||||
glLineVertex = pg.createVertexBufferObject(context.code());
|
||||
glLineVertex = pg.createVertexBufferObject(context.id());
|
||||
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());
|
||||
glLineColor = pg.createVertexBufferObject(context.id());
|
||||
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());
|
||||
glLineAttrib = pg.createVertexBufferObject(context.id());
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, glLineAttrib);
|
||||
pgl.bufferData(PGL.ARRAY_BUFFER, 4 * sizef,
|
||||
FloatBuffer.wrap(tessGeo.lineAttribs, 0, 4 * size),
|
||||
@@ -3431,7 +3431,7 @@ public class PShapeOpenGL extends PShape {
|
||||
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
|
||||
|
||||
glLineIndex = pg.createVertexBufferObject(context.code());
|
||||
glLineIndex = pg.createVertexBufferObject(context.id());
|
||||
pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, glLineIndex);
|
||||
pgl.bufferData(PGL.ELEMENT_ARRAY_BUFFER,
|
||||
tessGeo.lineIndexCount * PGL.SIZEOF_INDEX,
|
||||
@@ -3447,19 +3447,19 @@ public class PShapeOpenGL extends PShape {
|
||||
int sizef = size * PGL.SIZEOF_FLOAT;
|
||||
int sizei = size * PGL.SIZEOF_INT;
|
||||
|
||||
glPointVertex = pg.createVertexBufferObject(context.code());
|
||||
glPointVertex = pg.createVertexBufferObject(context.id());
|
||||
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());
|
||||
glPointColor = pg.createVertexBufferObject(context.id());
|
||||
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());
|
||||
glPointAttrib = pg.createVertexBufferObject(context.id());
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, glPointAttrib);
|
||||
pgl.bufferData(PGL.ARRAY_BUFFER, 2 * sizef,
|
||||
FloatBuffer.wrap(tessGeo.pointAttribs, 0, 2 * size),
|
||||
@@ -3467,7 +3467,7 @@ public class PShapeOpenGL extends PShape {
|
||||
|
||||
pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
|
||||
|
||||
glPointIndex = pg.createVertexBufferObject(context.code());
|
||||
glPointIndex = pg.createVertexBufferObject(context.id());
|
||||
pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, glPointIndex);
|
||||
pgl.bufferData(PGL.ELEMENT_ARRAY_BUFFER,
|
||||
tessGeo.pointIndexCount * PGL.SIZEOF_INDEX,
|
||||
@@ -3485,25 +3485,25 @@ public class PShapeOpenGL extends PShape {
|
||||
// doesn't get deleted by OpenGL. The VBOs were already
|
||||
// automatically disposed when the old context was
|
||||
// destroyed.
|
||||
pg.removeVertexBufferObject(glPolyVertex, context.code());
|
||||
pg.removeVertexBufferObject(glPolyColor, context.code());
|
||||
pg.removeVertexBufferObject(glPolyNormal, context.code());
|
||||
pg.removeVertexBufferObject(glPolyTexcoord, context.code());
|
||||
pg.removeVertexBufferObject(glPolyAmbient, context.code());
|
||||
pg.removeVertexBufferObject(glPolySpecular, context.code());
|
||||
pg.removeVertexBufferObject(glPolyEmissive, context.code());
|
||||
pg.removeVertexBufferObject(glPolyShininess, context.code());
|
||||
pg.removeVertexBufferObject(glPolyIndex, context.code());
|
||||
pg.removeVertexBufferObject(glPolyVertex, context.id());
|
||||
pg.removeVertexBufferObject(glPolyColor, context.id());
|
||||
pg.removeVertexBufferObject(glPolyNormal, context.id());
|
||||
pg.removeVertexBufferObject(glPolyTexcoord, context.id());
|
||||
pg.removeVertexBufferObject(glPolyAmbient, context.id());
|
||||
pg.removeVertexBufferObject(glPolySpecular, context.id());
|
||||
pg.removeVertexBufferObject(glPolyEmissive, context.id());
|
||||
pg.removeVertexBufferObject(glPolyShininess, context.id());
|
||||
pg.removeVertexBufferObject(glPolyIndex, context.id());
|
||||
|
||||
pg.removeVertexBufferObject(glLineVertex, context.code());
|
||||
pg.removeVertexBufferObject(glLineColor, context.code());
|
||||
pg.removeVertexBufferObject(glLineAttrib, context.code());
|
||||
pg.removeVertexBufferObject(glLineIndex, context.code());
|
||||
pg.removeVertexBufferObject(glLineVertex, context.id());
|
||||
pg.removeVertexBufferObject(glLineColor, context.id());
|
||||
pg.removeVertexBufferObject(glLineAttrib, context.id());
|
||||
pg.removeVertexBufferObject(glLineIndex, context.id());
|
||||
|
||||
pg.removeVertexBufferObject(glPointVertex, context.code());
|
||||
pg.removeVertexBufferObject(glPointColor, context.code());
|
||||
pg.removeVertexBufferObject(glPointAttrib, context.code());
|
||||
pg.removeVertexBufferObject(glPointIndex, context.code());
|
||||
pg.removeVertexBufferObject(glPointVertex, context.id());
|
||||
pg.removeVertexBufferObject(glPointColor, context.id());
|
||||
pg.removeVertexBufferObject(glPointAttrib, context.id());
|
||||
pg.removeVertexBufferObject(glPointIndex, context.id());
|
||||
|
||||
// The OpenGL resources have been already deleted
|
||||
// when the context changed. We only need to zero
|
||||
@@ -3549,47 +3549,47 @@ public class PShapeOpenGL extends PShape {
|
||||
|
||||
protected void deletePolyBuffers() {
|
||||
if (glPolyVertex != 0) {
|
||||
pg.deleteVertexBufferObject(glPolyVertex, context.code());
|
||||
pg.deleteVertexBufferObject(glPolyVertex, context.id());
|
||||
glPolyVertex = 0;
|
||||
}
|
||||
|
||||
if (glPolyColor != 0) {
|
||||
pg.deleteVertexBufferObject(glPolyColor, context.code());
|
||||
pg.deleteVertexBufferObject(glPolyColor, context.id());
|
||||
glPolyColor = 0;
|
||||
}
|
||||
|
||||
if (glPolyNormal != 0) {
|
||||
pg.deleteVertexBufferObject(glPolyNormal, context.code());
|
||||
pg.deleteVertexBufferObject(glPolyNormal, context.id());
|
||||
glPolyNormal = 0;
|
||||
}
|
||||
|
||||
if (glPolyTexcoord != 0) {
|
||||
pg.deleteVertexBufferObject(glPolyTexcoord, context.code());
|
||||
pg.deleteVertexBufferObject(glPolyTexcoord, context.id());
|
||||
glPolyTexcoord = 0;
|
||||
}
|
||||
|
||||
if (glPolyAmbient != 0) {
|
||||
pg.deleteVertexBufferObject(glPolyAmbient, context.code());
|
||||
pg.deleteVertexBufferObject(glPolyAmbient, context.id());
|
||||
glPolyAmbient = 0;
|
||||
}
|
||||
|
||||
if (glPolySpecular != 0) {
|
||||
pg.deleteVertexBufferObject(glPolySpecular, context.code());
|
||||
pg.deleteVertexBufferObject(glPolySpecular, context.id());
|
||||
glPolySpecular = 0;
|
||||
}
|
||||
|
||||
if (glPolyEmissive != 0) {
|
||||
pg.deleteVertexBufferObject(glPolyEmissive, context.code());
|
||||
pg.deleteVertexBufferObject(glPolyEmissive, context.id());
|
||||
glPolyEmissive = 0;
|
||||
}
|
||||
|
||||
if (glPolyShininess != 0) {
|
||||
pg.deleteVertexBufferObject(glPolyShininess, context.code());
|
||||
pg.deleteVertexBufferObject(glPolyShininess, context.id());
|
||||
glPolyShininess = 0;
|
||||
}
|
||||
|
||||
if (glPolyIndex != 0) {
|
||||
pg.deleteVertexBufferObject(glPolyIndex, context.code());
|
||||
pg.deleteVertexBufferObject(glPolyIndex, context.id());
|
||||
glPolyIndex = 0;
|
||||
}
|
||||
}
|
||||
@@ -3597,22 +3597,22 @@ public class PShapeOpenGL extends PShape {
|
||||
|
||||
protected void deleteLineBuffers() {
|
||||
if (glLineVertex != 0) {
|
||||
pg.deleteVertexBufferObject(glLineVertex, context.code());
|
||||
pg.deleteVertexBufferObject(glLineVertex, context.id());
|
||||
glLineVertex = 0;
|
||||
}
|
||||
|
||||
if (glLineColor != 0) {
|
||||
pg.deleteVertexBufferObject(glLineColor, context.code());
|
||||
pg.deleteVertexBufferObject(glLineColor, context.id());
|
||||
glLineColor = 0;
|
||||
}
|
||||
|
||||
if (glLineAttrib != 0) {
|
||||
pg.deleteVertexBufferObject(glLineAttrib, context.code());
|
||||
pg.deleteVertexBufferObject(glLineAttrib, context.id());
|
||||
glLineAttrib = 0;
|
||||
}
|
||||
|
||||
if (glLineIndex != 0) {
|
||||
pg.deleteVertexBufferObject(glLineIndex, context.code());
|
||||
pg.deleteVertexBufferObject(glLineIndex, context.id());
|
||||
glLineIndex = 0;
|
||||
}
|
||||
}
|
||||
@@ -3620,22 +3620,22 @@ public class PShapeOpenGL extends PShape {
|
||||
|
||||
protected void deletePointBuffers() {
|
||||
if (glPointVertex != 0) {
|
||||
pg.deleteVertexBufferObject(glPointVertex, context.code());
|
||||
pg.deleteVertexBufferObject(glPointVertex, context.id());
|
||||
glPointVertex = 0;
|
||||
}
|
||||
|
||||
if (glPointColor != 0) {
|
||||
pg.deleteVertexBufferObject(glPointColor, context.code());
|
||||
pg.deleteVertexBufferObject(glPointColor, context.id());
|
||||
glPointColor = 0;
|
||||
}
|
||||
|
||||
if (glPointAttrib != 0) {
|
||||
pg.deleteVertexBufferObject(glPointAttrib, context.code());
|
||||
pg.deleteVertexBufferObject(glPointAttrib, context.id());
|
||||
glPointAttrib = 0;
|
||||
}
|
||||
|
||||
if (glPointIndex != 0) {
|
||||
pg.deleteVertexBufferObject(glPointIndex, context.code());
|
||||
pg.deleteVertexBufferObject(glPointIndex, context.id());
|
||||
glPointIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ public class Texture implements PConstants {
|
||||
protected void finalize() throws Throwable {
|
||||
try {
|
||||
if (glName != 0) {
|
||||
pg.finalizeTextureObject(glName, context.code());
|
||||
pg.finalizeTextureObject(glName, context.id());
|
||||
}
|
||||
} finally {
|
||||
super.finalize();
|
||||
@@ -1130,7 +1130,7 @@ public class Texture implements PConstants {
|
||||
}
|
||||
|
||||
context = pgl.getCurrentContext();
|
||||
glName = pg.createTextureObject(context.code());
|
||||
glName = pg.createTextureObject(context.id());
|
||||
|
||||
pgl.bindTexture(glTarget, glName);
|
||||
pgl.texParameteri(glTarget, PGL.TEXTURE_MIN_FILTER, glMinFilter);
|
||||
@@ -1161,7 +1161,7 @@ public class Texture implements PConstants {
|
||||
*/
|
||||
protected void release() {
|
||||
if (glName != 0) {
|
||||
pg.finalizeTextureObject(glName, context.code());
|
||||
pg.finalizeTextureObject(glName, context.id());
|
||||
glName = 0;
|
||||
}
|
||||
}
|
||||
@@ -1173,7 +1173,7 @@ public class Texture implements PConstants {
|
||||
// Removing the texture object from the renderer's list so it
|
||||
// doesn't get deleted by OpenGL. The texture object was
|
||||
// automatically disposed when the old context was destroyed.
|
||||
pg.removeTextureObject(glName, context.code());
|
||||
pg.removeTextureObject(glName, context.id());
|
||||
|
||||
// And then set the id to zero, so it doesn't try to be
|
||||
// deleted when the object's finalizer is invoked by the GC.
|
||||
|
||||
Reference in New Issue
Block a user