简体   繁体   中英

How to stop rendering a rajawali renderer object on event handler?

I am rendering a rajawali renderer object as

public void onCreate(Bundle savedInstanceState) 
{

// initializing camera etc.

       mSurfaceView.setZOrderMediaOverlay(true);
        setGLBackgroundTransparent(true);
        mRenderer = new Renderer(this);
        mRenderer.setSurfaceView(mSurfaceView);
        super.setRenderer(mRenderer);
        mRenderer.setCameraPosition(0, 0, 20);

}

where mRenderer is an object of a class Renderer that extends rajawalirenderer

public class Renderer extends RajawaliRenderer 
{
...// code for rendering a textured sphere
}

Now I want to stop the rendering of this 3d object(sphere) on some event handler, say button click. (And once the rendering is stopped, I again want to render a different 3d object on button click.)

How can I stop the rendering of 3d object sphere?

After searching a bit, I found the answer. There's a method named removeChild that-

Requests the removal of a child from the scene.

Parameters: child Object3D child to be removed.
Returns: boolean True if the child was successfully queued for removal.

Example.. getCurrentScene().removeChild(3d_Object);

where 3d_Object is the object which we don't want to render.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM