GVRShader makeTemplate ( Class < ? extends GVRShader > id , GVRContext ctx ) { try { Constructor < ? extends GVRShader > maker = id . getDeclaredConstructor ( GVRContext . class ) ; return maker . newInstance ( ctx ) ; } catch ( NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException ex ) { try { Constructor < ? extends GVRShader > maker = id . getDeclaredConstructor ( ) ; return maker . newInstance ( ) ; } catch ( NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException ex2 ) { ctx . getEventManager ( ) . sendEvent ( ctx , IErrorEvents . class , "onError" , new Object [ ] { ex2 . getMessage ( ) , this } ) ; return null ; } } }
Instantiates an instance of input Java shader class which must be derived from GVRShader or GVRShaderTemplate .