Created
December 6, 2011 01:44
-
-
Save dalinaum/1436313 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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