@@ -237,8 +237,6 @@ public class PGraphicsOpenGL extends PGraphics {
237237 // Useful to have around.
238238 static protected PMatrix3D identity = new PMatrix3D ();
239239
240- protected boolean matricesAllocated = false ;
241-
242240 /**
243241 * Marks when changes to the size have occurred, so that the camera
244242 * will be reset in beginDraw().
@@ -312,8 +310,6 @@ public class PGraphicsOpenGL extends PGraphics {
312310 public float currentLightFalloffLinear ;
313311 public float currentLightFalloffQuadratic ;
314312
315- protected boolean lightsAllocated = false ;
316-
317313 // ........................................................
318314
319315 // Texturing:
@@ -538,6 +534,23 @@ public PGraphicsOpenGL() {
538534 tessGeo = newTessGeometry (this , IMMEDIATE );
539535 texCache = newTexCache (this );
540536
537+ projection = new PMatrix3D ();
538+ camera = new PMatrix3D ();
539+ cameraInv = new PMatrix3D ();
540+ modelview = new PMatrix3D ();
541+ modelviewInv = new PMatrix3D ();
542+ projmodelview = new PMatrix3D ();
543+
544+ lightType = new int [PGL .MAX_LIGHTS ];
545+ lightPosition = new float [4 * PGL .MAX_LIGHTS ];
546+ lightNormal = new float [3 * PGL .MAX_LIGHTS ];
547+ lightAmbient = new float [3 * PGL .MAX_LIGHTS ];
548+ lightDiffuse = new float [3 * PGL .MAX_LIGHTS ];
549+ lightSpecular = new float [3 * PGL .MAX_LIGHTS ];
550+ lightFalloffCoefficients = new float [3 * PGL .MAX_LIGHTS ];
551+ lightSpotParameters = new float [2 * PGL .MAX_LIGHTS ];
552+ currentLightSpecular = new float [3 ];
553+
541554 initialized = false ;
542555 }
543556
@@ -571,8 +584,6 @@ public void setSize(int iwidth, int iheight) {
571584 width = iwidth ;
572585 height = iheight ;
573586
574- allocate ();
575-
576587 // init perspective projection based on new dimensions
577588 cameraFOV = 60 * DEG_TO_RAD ; // at least for now
578589 cameraX = width / 2.0f ;
@@ -586,41 +597,6 @@ public void setSize(int iwidth, int iheight) {
586597 }
587598
588599
589- /**
590- * Called by resize(), this handles creating the actual GLCanvas the
591- * first time around, or simply resizing it on subsequent calls.
592- * There is no pixel array to allocate for an OpenGL canvas
593- * because OpenGL's pixel buffer is all handled internally.
594- */
595- @ Override
596- protected void allocate () {
597- super .allocate ();
598-
599- if (!matricesAllocated ) {
600- projection = new PMatrix3D ();
601- camera = new PMatrix3D ();
602- cameraInv = new PMatrix3D ();
603- modelview = new PMatrix3D ();
604- modelviewInv = new PMatrix3D ();
605- projmodelview = new PMatrix3D ();
606- matricesAllocated = true ;
607- }
608-
609- if (!lightsAllocated ) {
610- lightType = new int [PGL .MAX_LIGHTS ];
611- lightPosition = new float [4 * PGL .MAX_LIGHTS ];
612- lightNormal = new float [3 * PGL .MAX_LIGHTS ];
613- lightAmbient = new float [3 * PGL .MAX_LIGHTS ];
614- lightDiffuse = new float [3 * PGL .MAX_LIGHTS ];
615- lightSpecular = new float [3 * PGL .MAX_LIGHTS ];
616- lightFalloffCoefficients = new float [3 * PGL .MAX_LIGHTS ];
617- lightSpotParameters = new float [2 * PGL .MAX_LIGHTS ];
618- currentLightSpecular = new float [3 ];
619- lightsAllocated = true ;
620- }
621- }
622-
623-
624600 @ Override
625601 public void dispose () { // PGraphics
626602 super .dispose ();
0 commit comments