Game Development Community

Render To Texture

by Kiyaku · in Torque Game Builder · 06/25/2007 (1:13 pm) · 6 replies

Hi,

is it possible to do Render to Texture with TGB?

I want to do a magnifier with it, here an example video where i do it with another engine:


Magnifier

#1
06/25/2007 (8:06 pm)
You can't render to a texture, but you could achieve a similar effect by using an additional scenegraph. Create a new scenegraph, set its position to track the mouse, and set its zoom (%sceneWindow.SetCurrentCameraZoom(%val) I think). The only downside is the zoomed area can only be square.

If you have to have it circular like in your video, it is possible, but it's pretty obscure to set up and not very efficient. This should get you started.
#2
06/26/2007 (3:02 am)
Thank you for the answer. This helps a lot and i will look into the link you gave me.
#3
07/05/2007 (9:17 am)
Another question,
is it possible to put the second scenegraph under a sprite?
I drew a border for the magnifier and want to put the scenegraph under it.
#4
07/05/2007 (9:35 am)
Looks good
#5
07/05/2007 (6:46 pm)
Kiyaku, as long as the border is transparent in the middle ... you will be able to see through it ...

However, you might require three scenegraphs at that point due to the layering ... actually, pretty sure you'd need three scenegraphs to do that ...

To get away with only using 2 scenegraphs however, you could place the border in the initial scenegraph, place it in a scenegraph group and then omit that group from displaying in one graph while showing in another -- this way, the engine will scale the border and display it 'around' the magnifier glass graph ... the image you use for the border could be of any size ... but would most likely have to be rectangular to pull this off ...

If you wanted to actually use a magnifier glass image and only show the magnification inside the rounded area ... a third scenegraph placed on top of the magnifier graph would most likely be needed and you'd have to update the movement to follow the magnifier graph ...
#6
07/10/2007 (3:24 pm)
Okay thanks to everyone, with all your help i finally did it as seen here

Magnifier Torque Version

Thanks again!