PDA

View Full Version : Rotate and read back



image28
05-21-2011, 04:37 PM
Is there a way to map a texture to a quad, rotate the quad and read back the rotated image to perform collision detection on the rotated image. Currently I am detecting collision between the rectangles of two objects then comparing the pixels of the two image files. But to perform rotations I would have to create pre-rotated image files for every sprite that is rotated.

Can't re-read the rotated image from the screen because there is a background under the images, and glReadPixels is way to slow.

Any idea's would be appreciated.
Reading about PBO's, but the only example I can find reads the whole framebuffer back.

Alfonse Reinheart
05-21-2011, 11:50 PM
But to perform rotations I would have to create pre-rotated image files for every sprite that is rotated.

Or you could just rotate it yourself, on the CPU.

Rendering and doing readback for something this trivial is almost certainly going to be slower than just doing a CPU-based test.


Can't re-read the rotated image from the screen because there is a background under the images, and glReadPixels is way to slow.

There's no other way to read data back than glReadPixels. That's what it's for.