@@ -602,27 +602,13 @@ public void setSize(int iwidth, int iheight) {
602602
603603 @ Override
604604 public void dispose () { // PGraphics
605- super .dispose ();
606-
607- if (primaryGraphics ) {
608- // Swap buffers the end to make sure that no
609- // garbage is shown on the screen, this particularly
610- // affects non-interactive sketches on windows that
611- // render only 1 frame, so no enough rendering
612- // iterations have been conducted so far to properly
613- // initialize all the buffers.
614- pgl .swapBuffers ();
615- }
616-
617605 if (asyncPixelReader != null ) {
618606 asyncPixelReader .dispose ();
619607 asyncPixelReader = null ;
620608 }
621609
622- deleteSurfaceTextures ();
623- if (primaryGraphics ) {
624- deleteDefaultShaders ();
625- } else {
610+ if (!primaryGraphics ) {
611+ deleteSurfaceTextures ();
626612 FrameBuffer ofb = offscreenFramebuffer ;
627613 FrameBuffer mfb = multisampleFramebuffer ;
628614 if (ofb != null ) {
@@ -634,6 +620,8 @@ public void dispose() { // PGraphics
634620 }
635621
636622 pgl .dispose ();
623+
624+ super .dispose ();
637625 }
638626
639627
@@ -700,7 +688,8 @@ public PSurface createSurface() { // ignore
700688
701689 public boolean saveImpl (String filename ) {
702690 return super .save (filename ); // ASYNC save frame using PBOs not yet available on Android
703- /*
691+
692+ /*
704693 if (getHint(DISABLE_ASYNC_SAVEFRAME)) {
705694 // Act as an opaque surface for the purposes of saving.
706695 if (primaryGraphics) {
@@ -1242,11 +1231,6 @@ protected void createPolyBuffers() {
12421231 if (!polyBuffersCreated || polyBuffersContextIsOutdated ()) {
12431232 polyBuffersContext = pgl .getCurrentContext ();
12441233
1245- // int sizef = INIT_VERTEX_BUFFER_SIZE * PGL.SIZEOF_FLOAT;
1246- // int sizei = INIT_VERTEX_BUFFER_SIZE * PGL.SIZEOF_INT;
1247- // int sizex = INIT_INDEX_BUFFER_SIZE * PGL.SIZEOF_INDEX;
1248-
1249-
12501234 bufPolyVertex = new VertexBuffer (this , PGL .ARRAY_BUFFER , 3 , PGL .SIZEOF_FLOAT );
12511235 bufPolyColor = new VertexBuffer (this , PGL .ARRAY_BUFFER , 1 , PGL .SIZEOF_INT );
12521236 bufPolyNormal = new VertexBuffer (this , PGL .ARRAY_BUFFER , 3 , PGL .SIZEOF_FLOAT );
@@ -1259,44 +1243,6 @@ protected void createPolyBuffers() {
12591243 bufPolyIndex = new VertexBuffer (this , PGL .ELEMENT_ARRAY_BUFFER , 1 , PGL .SIZEOF_INDEX , true );
12601244 pgl .bindBuffer (PGL .ELEMENT_ARRAY_BUFFER , 0 );
12611245
1262-
1263- // glPolyVertex = createVertexBufferObject(polyBuffersContext, pgl);
1264- // pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyVertex);
1265- // pgl.bufferData(PGL.ARRAY_BUFFER, 3 * sizef, null, PGL.STATIC_DRAW);
1266- //
1267- // glPolyColor = createVertexBufferObject(polyBuffersContext, pgl);
1268- // pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyColor);
1269- // pgl.bufferData(PGL.ARRAY_BUFFER, sizei, null, PGL.STATIC_DRAW);
1270- //
1271- // glPolyNormal = createVertexBufferObject(polyBuffersContext, pgl);
1272- // pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyNormal);
1273- // pgl.bufferData(PGL.ARRAY_BUFFER, 3 * sizef, null, PGL.STATIC_DRAW);
1274- //
1275- // glPolyTexcoord = createVertexBufferObject(polyBuffersContext, pgl);
1276- // pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyTexcoord);
1277- // pgl.bufferData(PGL.ARRAY_BUFFER, 2 * sizef, null, PGL.STATIC_DRAW);
1278- //
1279- // glPolyAmbient = createVertexBufferObject(polyBuffersContext, pgl);
1280- // pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyAmbient);
1281- // pgl.bufferData(PGL.ARRAY_BUFFER, sizei, null, PGL.STATIC_DRAW);
1282- //
1283- // glPolySpecular = createVertexBufferObject(polyBuffersContext, pgl);
1284- // pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolySpecular);
1285- // pgl.bufferData(PGL.ARRAY_BUFFER, sizei, null, PGL.STATIC_DRAW);
1286- //
1287- // glPolyEmissive = createVertexBufferObject(polyBuffersContext, pgl);
1288- // pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyEmissive);
1289- // pgl.bufferData(PGL.ARRAY_BUFFER, sizei, null, PGL.STATIC_DRAW);
1290- //
1291- // glPolyShininess = createVertexBufferObject(polyBuffersContext, pgl);
1292- // pgl.bindBuffer(PGL.ARRAY_BUFFER, glPolyShininess);
1293- // pgl.bufferData(PGL.ARRAY_BUFFER, sizef, null, PGL.STATIC_DRAW);
1294- // pgl.bindBuffer(PGL.ARRAY_BUFFER, 0);
1295- // glPolyIndex = createVertexBufferObject(polyBuffersContext, pgl);
1296- // pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, glPolyIndex);
1297- // pgl.bufferData(PGL.ELEMENT_ARRAY_BUFFER, sizex, null, PGL.STATIC_DRAW);
1298- // pgl.bindBuffer(PGL.ELEMENT_ARRAY_BUFFER, 0);
1299-
13001246 polyBuffersCreated = true ;
13011247 }
13021248
@@ -7007,20 +6953,6 @@ public void resetShader(int kind) {
70076953 }
70086954
70096955
7010- protected void deleteDefaultShaders () {
7011- // The default shaders contains references to the PGraphics object that
7012- // creates them, so when restarting the renderer, those references should
7013- // dissapear.
7014- defColorShader = null ;
7015- defTextureShader = null ;
7016- defLightShader = null ;
7017- defTexlightShader = null ;
7018- defLineShader = null ;
7019- defPointShader = null ;
7020- maskShader = null ;
7021- }
7022-
7023-
70246956 protected PShader getPolyShader (boolean lit , boolean tex ) {
70256957 PShader shader ;
70266958 PGraphicsOpenGL ppg = getPrimaryPG ();
0 commit comments