Rendering a geometry only once at a certain moment

Hello. I want to render a shape only once, at a certain point of the execution. I’m trying to write to the stencil buffer, so I activate writing to it, then I want to render a geometry into that buffer, and then deactivate writing. I want to do that only once in the execution of my program and not on every frame. If I set the stencil buffer and then call rm.renderGeometry(…) and the disable it, I don’t get any effect. How can I do that? Thanks!

You want to render it to screen? or in a texture?

The screen buffer is cleared every frame, so you can’t just render something once and have it stay there.

If you want to render in a FrameBuffer look at TestRenderToTexture

You can disable clearing of the stencil buffer on the main viewport.