@@ -441,8 +441,6 @@ public class PGL {
441441 protected static FBObject .TextureAttachment backTexAttach ;
442442 protected static FBObject .TextureAttachment frontTexAttach ;
443443
444- protected static boolean needToClearBuffers ;
445-
446444 ///////////////////////////////////////////////////////////
447445
448446 // Texture rendering
@@ -538,7 +536,6 @@ public PGL(PGraphicsOpenGL pg) {
538536 fboLayerCreated = false ;
539537 fboLayerInUse = false ;
540538 firstFrame = false ;
541- needToClearBuffers = false ;
542539 }
543540
544541 byteBuffer = allocateByteBuffer (1 );
@@ -628,13 +625,12 @@ protected void initSurface(int antialias) {
628625 caps .setDepthBits (request_depth_bits );
629626 caps .setStencilBits (request_stencil_bits );
630627 caps .setAlphaBits (request_alpha_bits );
631-
628+ caps . setDefaultColor ( pg . backgroundColor );
632629
633630 if (toolkit == AWT ) {
634631 canvasAWT = new GLCanvas (caps );
635632 canvasAWT .setBounds (0 , 0 , pg .width , pg .height );
636- canvasAWT .setBackground (Color .BLACK );
637- canvasAWT .setForeground (Color .BLACK );
633+ canvasAWT .setBackground (new Color (pg .backgroundColor , true ));
638634
639635 pg .parent .setLayout (new BorderLayout ());
640636 pg .parent .add (canvasAWT , BorderLayout .CENTER );
@@ -655,8 +651,7 @@ protected void initSurface(int antialias) {
655651 window = GLWindow .create (caps );
656652 canvasNEWT = new NewtCanvasAWT (window );
657653 canvasNEWT .setBounds (0 , 0 , pg .width , pg .height );
658- canvasNEWT .setBackground (Color .BLACK );
659- canvasNEWT .setForeground (Color .BLACK );
654+ canvasNEWT .setBackground (new Color (pg .backgroundColor , true ));
660655
661656 pg .parent .setLayout (new BorderLayout ());
662657 pg .parent .add (canvasNEWT , BorderLayout .CENTER );
@@ -684,7 +679,6 @@ protected void initSurface(int antialias) {
684679 fboLayerCreated = false ;
685680 fboLayerInUse = false ;
686681 firstFrame = true ;
687- needToClearBuffers = true ;
688682 }
689683
690684
@@ -701,7 +695,6 @@ protected void deleteSurface() {
701695 fboLayerCreated = false ;
702696 fboLayerInUse = false ;
703697 firstFrame = false ;
704- needToClearBuffers = false ;
705698 }
706699
707700
@@ -3137,17 +3130,6 @@ public void display(GLAutoDrawable glDrawable) {
31373130 gl2x = null ;
31383131 }
31393132
3140- if (needToClearBuffers ) {
3141- // Cleaning all buffers for the first time.
3142- gl .glClearDepthf (1 );
3143- gl .glClearStencil (0 );
3144- gl .glClearColor (0 , 0 , 0 , 0 );
3145- gl .glClear (GL .GL_COLOR_BUFFER_BIT | GL .GL_DEPTH_BUFFER_BIT |
3146- GL .GL_STENCIL_BUFFER_BIT );
3147- needToClearBuffers = false ;
3148- drawable .swapBuffers ();
3149- }
3150-
31513133 if (USE_JOGL_FBOLAYER && capabilities .isFBO ()) {
31523134 // The onscreen drawing surface is backed by an FBO layer.
31533135 GLFBODrawable fboDrawable = null ;
0 commit comments