Skip to main content
gamedev.net
🔒 Locked

Rotating images

Started by Eitsch 7 replies 600+ views
Original Post
Eitsch
Eitsch
i know i could rotate the texture matrix but i want to store the rotated image in ram. there is gluScaleImage. is there also a rotation function. i could store the image data in 2 dimensional array and rotate the indices. is there a better way to rotate image data?
Zipster
Zipster
Would it be possible to render a rotated quad with this texture to another texture rendertarget? The reason being that it's a pain in the butt to implement a decent image rotation method.
Eitsch
Eitsch
texture would be filtered during rendering to texture. i want to avoid this....
another method? (ok i could draw the bitmap data and turn rotate the eyepoint, capture the image and bind my texture)

a need a method which really transforms the pixel data..
ff8
ff8
u can rotate u textur by rotating GL_TEXTURE matrix
glMatrixMode(GL_TEXTURE);
then u can use glRotate* or ur own calculate.
cya ,
LilBudyWizer
LilBudyWizer
I believe the only thing rotated with a bitmap is the raster position. Ultimately, even if you did it by hand, some type of filtering is going to have to be applied. You could use nearest rather than linear interpolation, but something has to be use for rotations other than multiples of 90 degrees.
Keys to success: Ability, ambition and opportunity.
Eitsch
Eitsch
@ff8: i said i don't want to maniplate the matrix because i need this runtime several times.

ok thanks..i will render to texture.
jdaniel
jdaniel

I believe what you may be looking for is an algorithm to do anti-aliased image rotation. If you do not mind paying a computational expense and then storing the texture for later retrieval, you could use an Aarot rotation algorithm to rotate the bitmap. It is too slow for any real-time rotations, however.

Here's link of an explanation and VC++6 source files.

Aarot Anti-Aliased Image Rotation
Jernej.L
Jernej.L
any image rotating in software or cpu will be slow, the matrix rotation would definetly look better and faster, if you still need to rotate the bitmap you should rather translate the texture vertices using sin and cos.
Projects: Top Down City: http://mathpudding.com/
Eitsch
Eitsch
thanks to all

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.