@@ -467,20 +467,26 @@ public void onCreate(Bundle savedInstanceState) {
467
467
int sw = sketchWidth ();
468
468
int sh = sketchHeight ();
469
469
470
+ //get renderer name anc class
470
471
String renderer_name = sketchRenderer ();
471
472
Class <?> renderer_class = null ;
472
473
try {
473
474
renderer_class = Class .forName ( renderer_name );}
474
475
catch ( ClassNotFoundException exception ){
475
476
//what to throw here?
476
477
throw new RuntimeException (
477
- "Error: Could not resolve renderer class name" , exception );}
478
+ String .format (
479
+ "Error: Could not resolve renderer class name: %s" , renderer_name ),
480
+ exception );}
478
481
482
+ //java2d renderer
479
483
if ( renderer_name .equals ( JAVA2D ))
480
484
surfaceView = new SketchSurfaceView ( this , sw , sh );
485
+ //P2D, P3D, and any other PGraphicsOpenGL-based renderer
481
486
else if ( PGraphicsOpenGL .class .isAssignableFrom ( renderer_class ))
482
487
surfaceView = new SketchSurfaceViewGL ( this , sw , sh ,
483
488
(Class <? extends PGraphicsOpenGL >) renderer_class );
489
+ //anything else
484
490
else throw new RuntimeException (
485
491
String .format (
486
492
"Error: Unsupported renderer class: %s" ,
@@ -822,10 +828,13 @@ public SketchSurfaceViewGL(
822
828
// this.onResume() and thus require a valid renderer) are triggered
823
829
// before surfaceChanged() is ever called.
824
830
831
+ //P2D
825
832
if ( renderer_class .equals ( PGraphics2D .class ))
826
833
g3 = new PGraphics2D ();
834
+ //P3D
827
835
else if ( renderer_class .equals ( PGraphics3D .class ))
828
836
g3 = new PGraphics3D ();
837
+ //something that extends P2D or P3D
829
838
else
830
839
try {
831
840
//dang java generics
0 commit comments