2D Image rotation help

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
fishy417
Posts: 11
Joined: Wed Jan 30, 2008 4:35 am
Location: Australia

2D Image rotation help

Post by fishy417 »

Hi,

I'm trying to draw images on screen as textures using quads but allowing you to rotate the image as well. looking at the forums there is are two examples. One that seems really math intensive and might affect to performance the other I like because its simple, seems to work fine and easy to convert to BlitzMAX.

The only issue with the first option listed below is that when the images are draw against the edge (half off the screen) it distorts the image instead of drawing it off the screen. I'm guessing this is the point of the setViewport() function but doesn't work with negative values which i need for what i am doing. Is there a way to clip the viewport to just render the part of the texture that is on screen and not distort the image?

http://irrlicht.sourceforge.net/phpBB2/ ... 5140#95140

Otherwise there is this option which looks much more math intensive and harde to convert to BlitzMAX wrapper so haven't tested to see if it will render half images etc correctly.

any help would be great, even if its just in C++ or the language of the examples above i can convert to BMax.

Thanks,

http://irrlicht.sourceforge.net/phpBB2/ ... fe034e18c0
Lonesome Ducky
Competition winner
Posts: 1123
Joined: Sun Jun 10, 2007 11:14 pm

Post by Lonesome Ducky »

The second option shouldn't be too hard to convert to a BlitzMAX wrapper, at the end of that thread I posted an updated version that uses the irrlicht vector2df for rotation calculation, so if you have wrapped that class, you can use it exactly that way.

Vitek's method (the first one) could be fixed for you by not even using a viewport. You'd have to calculate the screen coordinates to world coordinates, but that shouldn't be too hard. In fact, part of mine shows how you can calculate from screen coordinates to world coordinates for the image, the only difference is that vitek's uses hardware transformation for rotation, but that shouldn't be too hard to change in mine.

If you'd like, I could try making a version of mine that uses hardware transformation, so it will be faster, easier to understand, and easier to work with the blitzmax wrapper.
fishy417
Posts: 11
Joined: Wed Jan 30, 2008 4:35 am
Location: Australia

Post by fishy417 »

Hi Lonesome ducky,

That would be great if show me how to use yours with hardware transformation. I know yours wouldn't be overly taxing but any performance you can save anywhere always adds up, also if its less code and easier to read thats a bonus :)

Thanks
Post Reply