@@ -372,6 +372,11 @@ public SDLSurfaceView(PythonActivity act, String argument) {
372
372
}
373
373
} catch (PackageManager .NameNotFoundException e ) {
374
374
}
375
+
376
+ if ( ai .metaData .getInt ("surface.transparent" ) != 0 ) {
377
+ Log .d (TAG , "Surface will be transparent, so put on the top." );
378
+ setZOrderOnTop (true );
379
+ }
375
380
}
376
381
377
382
@@ -530,6 +535,11 @@ static void ackStop() {
530
535
*/
531
536
public void surfaceCreated (SurfaceHolder holder ) {
532
537
//Log.i(TAG, "surfaceCreated() is not handled :|");
538
+ synchronized (this ) {
539
+ if (!mStarted ) {
540
+ this .notifyAll ();
541
+ }
542
+ }
533
543
}
534
544
535
545
/**
@@ -545,7 +555,7 @@ public void surfaceDestroyed(SurfaceHolder holder) {
545
555
* not normally called or subclassed by clients of GLSurfaceView.
546
556
*/
547
557
public void surfaceChanged (SurfaceHolder holder , int format , int w , int h ) {
548
- //Log.i(TAG, "surfaceChanged() :|" );
558
+ //Log.i(TAG, String.format( "surfaceChanged() fmt=%d size=%dx%d", format, w, h) );
549
559
mWidth = w ;
550
560
mHeight = h ;
551
561
@@ -653,14 +663,14 @@ public void run() {
653
663
return ;
654
664
}
655
665
656
- if ( ai .metaData .getInt ("surface.transluent " ) != 0 ) {
657
- Log .i (TAG , "Surface will be transluent " );
658
- getHolder ().setFormat (PixelFormat .TRANSLUCENT );
666
+ if ( ai .metaData .getInt ("surface.transparent " ) != 0 ) {
667
+ Log .i (TAG , "Surface will be transparent " );
668
+ getHolder ().setFormat (PixelFormat .TRANSPARENT );
659
669
} else {
660
- Log .i (TAG , "Surface will NOT be transluent " );
670
+ Log .i (TAG , "Surface will NOT be transparent " );
661
671
}
662
672
663
- Log .w (TAG , "Done" );
673
+ // Log.d (TAG, "Done");
664
674
waitForStart ();
665
675
666
676
nativeResize (mWidth , mHeight );
@@ -815,9 +825,15 @@ private void waitForStart() {
815
825
Matrix .multiplyMM (mMVPMatrix , 0 , mProjMatrix , 0 , mMVPMatrix , 0 );
816
826
817
827
GLES20 .glUniformMatrix4fv (muMVPMatrixHandle , 1 , false , mMVPMatrix , 0 );
818
- GLES20 .glDrawArrays (GLES20 .GL_TRIANGLES , 0 , 6 );
819
- checkGlError ("glDrawArrays" );
820
- swapBuffers ();
828
+
829
+ // Ensure that, even with double buffer, or if we lost one buffer (like
830
+ // BufferQueue has been abandoned!), it will work.
831
+ for ( int i = 0 ; i < 2 ; i ++ ) {
832
+ GLES20 .glClear (GLES20 .GL_DEPTH_BUFFER_BIT | GLES20 .GL_COLOR_BUFFER_BIT );
833
+ GLES20 .glDrawArrays (GLES20 .GL_TRIANGLES , 0 , 6 );
834
+ checkGlError ("glDrawArrays" );
835
+ swapBuffers ();
836
+ }
821
837
822
838
// Wait to be notified it's okay to start Python.
823
839
synchronized (this ) {
@@ -830,7 +846,6 @@ private void waitForStart() {
830
846
try {
831
847
this .wait (250 );
832
848
} catch (InterruptedException e ) {
833
- continue ;
834
849
}
835
850
}
836
851
}
0 commit comments