Rotating an image
-
- Posts: 62
- Joined: Wed Jun 09, 2004 5:51 am
Rotating an image
I need to rotate an image while running the program (ITexture actually) to give the user icon of my minimap some sense of direction. Is there any function/s that do this in the engine? I tried looking in the video namespace, but didnt find anything that I think could help me.
No, there is not and in my experience I dont think there is engine which have such function.
Way your problem is usualy solved (including comercial projects) is animated sprite. You make serie of pictures of the same object in diferent positions ...in your case your position indicator facing diferent angles. Of course not all 360 ...even if that would be posible too. Something betveen 8 - 16 should be enough depending on what you need.
Another way would be to use 3D plain object with texture and transparent background color ...that way you can easily rotate...
Way your problem is usualy solved (including comercial projects) is animated sprite. You make serie of pictures of the same object in diferent positions ...in your case your position indicator facing diferent angles. Of course not all 360 ...even if that would be posible too. Something betveen 8 - 16 should be enough depending on what you need.
Another way would be to use 3D plain object with texture and transparent background color ...that way you can easily rotate...
tip, 3D plain = two triangles = 6 vertices ... + its always more practical to aply texture on plain (call it square if you want) than on triangle since texture is square too.
..except when speed is most important like in particles.
...he cant use this method if he is doing 2D of course and even if not there is small problem with perspective usualy.
..except when speed is most important like in particles.
...he cant use this method if he is doing 2D of course and even if not there is small problem with perspective usualy.
-
- Posts: 62
- Joined: Wed Jun 09, 2004 5:51 am
Im making the minimap in the gui environment, so that rules out the 3D solution, as I've had very little sucess loading meshes thru the gui.
The animated sprite idea really appeals to me though , a rather noobish question I have is: how would I select which frame to show(that is, if im using a single sprite file, like a gif or something of that kind)?
The animated sprite idea really appeals to me though , a rather noobish question I have is: how would I select which frame to show(that is, if im using a single sprite file, like a gif or something of that kind)?
if you're using a gif... you'll need a library to uncompress the gif. as it's a copyrighted format, you may have problems.
PNGlib has some primitive to access the frames in animation.
Or simpler, you can use a big picture with all the frames side by side; and choose the source mapping coordinate changing every frame within the big picture.
PNGlib has some primitive to access the frames in animation.
Or simpler, you can use a big picture with all the frames side by side; and choose the source mapping coordinate changing every frame within the big picture.
-
- Posts: 62
- Joined: Wed Jun 09, 2004 5:51 am