@@ -602,27 +602,13 @@ public void setSize(int iwidth, int iheight) {
602
602
603
603
@ Override
604
604
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
-
617
605
if (asyncPixelReader != null ) {
618
606
asyncPixelReader .dispose ();
619
607
asyncPixelReader = null ;
620
608
}
621
609
622
- deleteSurfaceTextures ();
623
- if (primaryGraphics ) {
624
- deleteDefaultShaders ();
625
- } else {
610
+ if (!primaryGraphics ) {
611
+ deleteSurfaceTextures ();
626
612
FrameBuffer ofb = offscreenFramebuffer ;
627
613
FrameBuffer mfb = multisampleFramebuffer ;
628
614
if (ofb != null ) {
@@ -634,6 +620,8 @@ public void dispose() { // PGraphics
634
620
}
635
621
636
622
pgl .dispose ();
623
+
624
+ super .dispose ();
637
625
}
638
626
639
627
@@ -700,7 +688,8 @@ public PSurface createSurface() { // ignore
700
688
701
689
public boolean saveImpl (String filename ) {
702
690
return super .save (filename ); // ASYNC save frame using PBOs not yet available on Android
703
- /*
691
+
692
+ /*
704
693
if (getHint(DISABLE_ASYNC_SAVEFRAME)) {
705
694
// Act as an opaque surface for the purposes of saving.
706
695
if (primaryGraphics) {
@@ -1242,11 +1231,6 @@ protected void createPolyBuffers() {
1242
1231
if (!polyBuffersCreated || polyBuffersContextIsOutdated ()) {
1243
1232
polyBuffersContext = pgl .getCurrentContext ();
1244
1233
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
-
1250
1234
bufPolyVertex = new VertexBuffer (this , PGL .ARRAY_BUFFER , 3 , PGL .SIZEOF_FLOAT );
1251
1235
bufPolyColor = new VertexBuffer (this , PGL .ARRAY_BUFFER , 1 , PGL .SIZEOF_INT );
1252
1236
bufPolyNormal = new VertexBuffer (this , PGL .ARRAY_BUFFER , 3 , PGL .SIZEOF_FLOAT );
@@ -1259,44 +1243,6 @@ protected void createPolyBuffers() {
1259
1243
bufPolyIndex = new VertexBuffer (this , PGL .ELEMENT_ARRAY_BUFFER , 1 , PGL .SIZEOF_INDEX , true );
1260
1244
pgl .bindBuffer (PGL .ELEMENT_ARRAY_BUFFER , 0 );
1261
1245
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
-
1300
1246
polyBuffersCreated = true ;
1301
1247
}
1302
1248
@@ -7007,20 +6953,6 @@ public void resetShader(int kind) {
7007
6953
}
7008
6954
7009
6955
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
-
7024
6956
protected PShader getPolyShader (boolean lit , boolean tex ) {
7025
6957
PShader shader ;
7026
6958
PGraphicsOpenGL ppg = getPrimaryPG ();
0 commit comments