Indexing in Rectangles and draw2DImage

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
SimonHawe
Posts: 12
Joined: Wed Aug 27, 2008 1:57 pm

Indexing in Rectangles and draw2DImage

Post by SimonHawe »

Hi folks,
I wanna render to a texture. The texture is of size 16 times 16 create like this:
driver->createRenderTargetTexture(dimension2di(16,16))

Now i wanna make a source rect and a destnation rect like

rect<s32> sourceRect(x0, y0, x,y);
rect<s32> destRect(x1, y1,x2, y2);

and finally call
driver->draw2DImage(renderTarget, destRect, sourceRect);

Now the question is, do in the source rect x0 and y0 have to be 0 and x and y have to be 15, or is it x0/y0=1 and x/y=16 ?

Thank you and have a nive weekend
Simon
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Why don't you try it and see? Whichever's wrong should give you a border along 2 sides.

But i believe it's 0-15
Image Image Image
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

I don't know of any screen coordinate systems that are 1-indexed. Irrlicht is certainly 0-indexed.
I wanna render to a texture.
...

Code: Select all

driver->draw2DImage(renderTarget, destRect, sourceRect); 
Just so we're clear, that draws from renderTarget, not to it.

If you want to render to it, call driver->setRenderTarget(renderTarget,...), as per example 13.RenderToTexture.

Apologies if you already know this; it's not clear from your post.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
SimonHawe
Posts: 12
Joined: Wed Aug 27, 2008 1:57 pm

Post by SimonHawe »

i know it draws from render target was just a mistyping. but thanks for your answer now i know more
Post Reply