Skip to content

Instantly share code, notes, and snippets.

@dalinaum
Created December 6, 2011 01:44
Show Gist options
  • Save dalinaum/1436313 to your computer and use it in GitHub Desktop.
Save dalinaum/1436313 to your computer and use it in GitHub Desktop.
public class SimpleView extends RSSurfaceView {
private RenderScriptGL mRS;
private ScriptC_renderloop mScript;
public SimpleView( Context context ) {
super( context );
initRS();
}
private void initRS() {
if( mRS != null ){
return;
}
// RenderScriptGL 생성
RenderScriptGL.SurfaceConfig sc= new RenderScriptGL.SurfaceConfig();
mRS= createRenderScriptGL( sc );
Resources res= getContext().getResources();
// renderloop.rs 을 등록.
mScript= new ScriptC_renderloop( mRS, res, R.raw.renderloop );
mRS.bindRootScript( mScript );
}
@Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
initRS();
}
@Override
public void onDetachedFromWindow() {
if( mRS != null ){
mRS= null;
destroyRenderScriptGL();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment