Drawing a turned image
Blitz3D Forums/Blitz3D Beginners Area/Drawing a turned image
| ||
Is there a way to draw a turned image so that you don't need 360 images? |
| ||
RotateImage image,angle Don't try to do that in a loop though. I don't know why, but it makes the image go all weird. |
| ||
RotateImage is too slow. When you say "all weird", you need to rotate all images from the unrotated original. Reason being, when you rotate an image, say, 45 degrees. The [longer] diagonal dimensions of the original image become the width and height of the new image. If you repeat this process over and over, then your images will become exponentially larger. Anyway; to answer the original question: No. |
| ||
Well you could just load them as a texture, put them on a cube and rotate the cube instead. |
| ||
Use a 2d in 3d lib like nSprite 2 or spritecandy :) |
| ||
Well you could just load them as a texture, put them on a cube and rotate the cube instead. Why would you do that?Yes, the 3D route is an option but its senseless to use a cube (12 tris) when a quad (2 tris) will do. |
| ||
What do you think the speed would be like if I did:img=loadImage(...) turnedImg=copyImage(img) ;<-- EDIT RotateImage(turnedImage, ANGLE) PS-The game is a WinBolo (GNU) remake called BlitzBolo. |
| ||
What do you think rhe speed would be like if I did: You can't use CopyEntity on an image.img=loadImage(...) turnedImg=copyentity(img) RotateImage(turnedImage, ANGLE) I think you need some clarification on the difference between Images, Textures and Entities? |
| ||
Oh yeah. Im checking for a copyImage loke command. EDIT: OK, how about copyImage() instead./ |
| ||
Why would you do that? It just seemed like the right thing to say at the time ;) Yes, the 3D route is an option but its senseless to use a cube (12 tris) when a quad (2 tris) will do. |
| ||
CopyImage would work fine, provided you make a copy of the original, unrotated image, then rotate the copy. Instead of making 360 copies - one for every degree, you should consider every five degrees, or even every ten degrees. That way you only have 72 or 36 images instead of 360. |
| ||
What about in the loop likeWhile playing if keydown(RIGHT KEY) then free the image copy the normal one rodate the copy draw it end if LEFT KEY ... wend Or is the image freed if you write over it with a new one? |
| ||
No, you'll cause a memory leak that way. You need to manually free the image before copying a new one. Otherwise you'll clog up your RAM with hundreds and hundreds of out of scope images. You really need to precalculate the rotated images as rotateimage is nowhere near fast enough to work on the fly. |
| ||
OK. Thanks Everyone!!! |
| ||
i think you do it like this.Graphics 800,600,0,2 SetBuffer BackBuffer() sourceImg = LoadImage("anyPicture.bmp") numberOfFrames = 10; Dim imgs[numberOfFrames] For x = 0 To numberOfFrames-1 imgs[x] = CopyImage(sourceImg) RotateImage imgs[x],(360/numberOfFrames)*x Next x = 0; While Not KeyHit(1) Cls x = x + 1 if(x<numberOfFrames-1) x = x + 1 else x = 0; EndIf DrawImage imgs[i],0,0 Flip Wend End that should do it. :) |
| ||
Thanks alot Jerome! |
| ||
well I may be a bit late but check out my image system. You can rotate/scale/recolor to any degree in real time, no weird fx, and it is 2d in 3d. http://files.filefront.com/NTG+image+fixedzip/;12250961;/fileinfo.html wow, I dont even have my password to that filefront account anymore :p |