Draw a rendered texture in 2D.

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Zot
Posts: 15
Joined: Thu May 15, 2008 8:41 pm

Draw a rendered texture in 2D.

Post 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
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post 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!
Image Image Image
Zot
Posts: 15
Joined: Thu May 15, 2008 8:41 pm

Post 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)
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post 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.
Image Image Image
Zot
Posts: 15
Joined: Thu May 15, 2008 8:41 pm

Post 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?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post 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.
Zot
Posts: 15
Joined: Thu May 15, 2008 8:41 pm

Post by Zot »

Brilliant! Thanks.
Post Reply