PDA

View Full Version : drawing pixels



Gavin
07-17-2006, 04:42 PM
Hi all,
Ok with my project I am drawing an image, but the problem is that i need to perform an operation on every pixel. Currently its running at about 5-10fps and it needs to be real time. I have tried most simplistic speed measures. I am using draw pixels, as I thought that the constant loading of textures to memory would make texturing a quad slower? The image can get to about 500^2. Currently using gl bytes and GL_RGB, any other pointers or things I can turn on/off that will make an impact? My client is suggesting that I pre create all the images... uuuggghh, hardly ideal, especially due to the amount of code that would become redundant!

thanks

Thanks

charliejay
07-18-2006, 01:06 AM
From the Red Book:

glDrawPixels() - Writes a rectangular array of pixels from data kept in processor memory into the framebuffer at the current raster position specified by glRasterPos*().

Try using textures - a 512 x 512 RGBA image is 1 MB, so you can keep a fair number of them resident even on a card with low memory (say, 32 MB, by todays standards), plus they can be DMA'd to the card, which is probably the real advantage.

Relic
07-18-2006, 01:08 AM
"I am drawing an image"
What type of application is that?

"the problem is that i need to perform an operation on every pixel"
What operation exactly?
Could you do that using fragment shaders on the GPU?

"I am using draw pixels"
Generally not a fast solution.
Make sure everything affecting a simple 2D copy is off, like depth test, lighting, texturing, vertex and fragment programs, blending, etc.

"Currently using gl bytes and GL_RGB"
Try GL_UNSIGNED_BYTE in GL_BGR or GL_BGRA order as input. Some hardware uses that as native format and wouldn't need to swap R and B of your input data.

"My client is suggesting that I pre create all the images"
How many?
Do you get them from a changing input or are they all based on one single input with the "operation you need to perform on each pixel"?