Skip to content

Commit d5a19b8

Browse files
committed
added some comments and made an error message better
1 parent d701ecf commit d5a19b8

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

core/src/processing/core/PApplet.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,20 +467,26 @@ public void onCreate(Bundle savedInstanceState) {
467467
int sw = sketchWidth();
468468
int sh = sketchHeight();
469469

470+
//get renderer name anc class
470471
String renderer_name = sketchRenderer();
471472
Class<?> renderer_class = null;
472473
try{
473474
renderer_class = Class.forName( renderer_name);}
474475
catch( ClassNotFoundException exception){
475476
//what to throw here?
476477
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);}
478481

482+
//java2d renderer
479483
if( renderer_name.equals( JAVA2D))
480484
surfaceView = new SketchSurfaceView( this, sw, sh);
485+
//P2D, P3D, and any other PGraphicsOpenGL-based renderer
481486
else if( PGraphicsOpenGL.class.isAssignableFrom( renderer_class))
482487
surfaceView = new SketchSurfaceViewGL( this, sw, sh,
483488
(Class<? extends PGraphicsOpenGL>) renderer_class);
489+
//anything else
484490
else throw new RuntimeException(
485491
String.format(
486492
"Error: Unsupported renderer class: %s",
@@ -822,10 +828,13 @@ public SketchSurfaceViewGL(
822828
// this.onResume() and thus require a valid renderer) are triggered
823829
// before surfaceChanged() is ever called.
824830

831+
//P2D
825832
if( renderer_class.equals( PGraphics2D.class))
826833
g3 = new PGraphics2D();
834+
//P3D
827835
else if( renderer_class.equals( PGraphics3D.class))
828836
g3 = new PGraphics3D();
837+
//something that extends P2D or P3D
829838
else
830839
try{
831840
//dang java generics

0 commit comments

Comments
 (0)