Page 1 of 1

Draw a rendered texture in 2D.

Posted: Fri May 16, 2008 5:44 pm
by Zot
Hello, before I dive right into this nice little renderer, I need to know if Irrlight does what I need.
Can I render a scene to a texture, then render that texture where-ever I like in 2D on the screen, for example a zoomed in and rotated quad overlapping the edges?

Thanks,

Zot

Posted: Fri May 16, 2008 6:58 pm
by JP
Yep, there's a render-to-texture tutorial which shows you how to do rendering to a texture. In the tutorial the texture is applied to a cube but it can be simply drawn in 2D as well (drawing in 2D is also explained in a different tutorial).

Drawing it rotated though isn't as simple as the rendering to texture bit, but it can certainly be done and there are plenty of people that will be more than happy to help you!

Posted: Fri May 16, 2008 8:01 pm
by Zot
Thanks for the quick reply, this forum is very good indeed.
Looks like I'm set to go then, if I can specify the coordinates of the 2d quad/tris then I can rotate it! 8)

Posted: Fri May 16, 2008 8:22 pm
by JP
Yep, sounds like you've got the knowledge to pull it off. I'll point you at the custom scene node tutorial that you get in the SDK download for where to implement your quad. Just change the pyramidy shape to a simple quad and then you can just use the setRotation function to rotate it.

Although there's also the billboard scene node which is a quad always rotated to face the camera, i don't know if that's what you're actually after, if not you could also take the source for that scene node and cut out the rotating to face the camera bit and you'd get the same result as the above method.

Posted: Fri May 16, 2008 8:42 pm
by Zot
Hmm, I just simply want to draw two 2D triangles from the rendered texture, at four arbitrary vertices's. Does everything have to go through a 3D transform?

Posted: Fri May 16, 2008 10:07 pm
by hybrid
No, not necessary. Simply use the drawVertexPrimitiveList method to render an arbitrary vertex/index buffer on your own. It uses whatever transformation matrices you have set before.

Posted: Sat May 17, 2008 1:26 am
by Zot
Brilliant! Thanks.