UpdateRenderState during game

I want to add on the fly a terrain inside the scene.

To have the scene correctly rendered I have to call UpdateRenderState for the scene or the for the terrain.

During this process the game freezes.

It's possibile to avoid this ?

You're saying the OpenGL updates pause for a short amount of time when you call the method?

It pauses for about 3 seconds.

It freezes the rendering.

When you update your renderstates, are you updating them for the whole scene?  You should only need to update the Spatial/Batch that has changed.

The first time I've called the update on the whole scene and it takes about 5 seconds.

Than I've realized that it's only needed by the terrain and then it takes about 3 secons.



Are you actually swapping out states on the entire terrain?  Also 3 seconds sounds like an insane amount of time, even if you were updating states on a huge scene.  Have you profiled to make sure this is really what is slowing you down?