Game Development Community

Rendering to texture

by Justin Tolchin · in Torque Game Engine Advanced · 06/29/2005 (1:42 pm) · 3 replies

Hi all,

Would any of you graphics gurus out there be able to clue me in on how to do a render to texture in TSE? I want to replicate the mini-map functionality from the RTS kit and set up an overhead camera, render the terrain/water to a bitmap, and display that bitmap in a Gui control on the game screen. I have no idea how to use the GFX functions to do this. Any thoughts would be appreciated.

Thanks!

#1
06/29/2005 (3:54 pm)
Tried looking at how other places that render to texture (water, refraction, reflection code) do it?
#2
06/29/2005 (4:30 pm)
Hi Ben,

Well, I had been hunting around before I posted but I didn't see anything that made a lot of sense to me. I went back and started looking at the WaterBlock::updateReflection code and that seems to be what I need (I hope).

One part of it I don't understand, and thought maybe you might. What does this code do, and is it necessary?

// render a frame
...
...
...
   GFX->clear( GFXClearZBuffer | GFXClearStencil | GFXClearTarget, ColorI( 255, 255, 0 ), 1.0f, 0 );
...
...
...
   // cleanup
   GFX->clear( GFXClearZBuffer | GFXClearStencil, ColorI( 255, 0, 255 ), 1.0f, 0 );

Why is the color set to red/green for one and red/blue for the other? If I don't do this will it cause problems?

Thanks!
#3
06/29/2005 (5:58 pm)
Those are set to various colors for debug reasons. They don't mean anything.