Bitmap Rotation

Hello everyone,

I want to do a fast rotation with a bitmap at any angle (e.g a .GIF file of 500 kb). I know this can only be done (fast) with hardware acceleration. Can OpenGL help me to solve this problem and which hardware, that supports hardware accelerated bitmap rotation, do i need.

THANKS!!

If u want to draw a rotated bitmap with OpenGL then u must:
1/ load the picture to a texture
2/ load the texture to a square
3/ rotate the square

ps: it dont means that this is the only way to do it but i dont know any other.

[This message has been edited by Fredy (edited 03-28-2001).]

bitmap rotation can ONLY be done fast in hardware? <chokes on laughter> okay.

=)

cheers,
John

postscript. sorry, sarky mood. allow me to explain. the CPU is hardware. really, it is. yes, yes, its nice having graphics chips that alleviate some of the burden of graphics rendeirng, and thus people like calling this “hardware” acceleration because it magically appears as if the CPU does nothing (save calling the driver and doing whatever code the driver does to support the underling graphics chips).

Another way to rotate a bitmap is to iterate over the destination bitmap, and for each pixel in the destination map, work out its SOURCE pixel.

like this:

for(int x=0; x<w; x++) {
  for(int y=0; y<h; y++) {
    d=|(centre of image)-<x,y>|
    srcpixel=colour[cos(-angle)*d, sin(-angle)*d]
    destimg.put(x, y, srcpixel);
  }
}

sooookay, the fpu is doing the trig, but…gee, last time i looked the fpu was a piece of h/w, too.

yes, yes, I know i’m being somewhat… er… what’s the word? insane. but, my point is this:

graphics hardware is not the ONLY resource you have available to you. don’t run up and down excitedly and think its the bees’ knees of computation and that’ll only be a matter of time before some clever opengl guy can figure out to offload A.I. computation to the (TBA) Geforce 5 chip. Also, it isn’t NECESSARILY faster than the cpu. one of the points of having a graphics card with functions is to offload some of the processing, if at all possible… but its STILL just a computation resource just like any other computation resource on your system. also, it’s not THE hardware, its jsut SOME hardware.

(In, while i’m on my soap box, it’s not THE United States, its just SOME United States. feh. Last time I checked, Australia was also a collection of united states, but we don’t call ourselves THE states above all others, or indeed THE commonwealth, because we’re not. we’re the commonwealth OF australia, and the USA is the united states OF america. Not THE united states OF … (where … could be anything from the northern hemisphere to this side of the milkyway). If you see my point. Which you probably don’t, because it’s all been intrenched in everyone’s psyche. yer, yer, i’ll shut up, now)

feh.

[This message has been edited by john (edited 03-28-2001).]