PDA

View Full Version : Fastest approach for false color



Koen
09-18-2008, 06:48 AM
Hi,

I have monochrome video data that I'd like to show on the screen in false color. My current approach is to use glDrawPixels( w, h, GL_COLOR_INDEX, GL_UNSIGNED_BYTE, data ) and a color map set up by glPixelMap. However, this seems to be slow with todays graphics drivers on Windows (testing with XP here). If I disable some of the optimizations, speed increases, but this somehow tells me that I may be using an obsolete method.

My design goal is that my program should run on 'reasonable recent middle-of-the-road' hardware, using Windows, without tweaking drivers.

So, what would be my other options for drawing 2D 8-bit video data to the screen with false color? Or, more interesting, what would be the best or fastest approach? Should I look into the imaging extensions? Or do the false color mapping on the CPU and write RGBA data? Or use some pixel shader?

Thanks!

Koen

trinitrotoluene
09-18-2008, 07:04 AM
Just an idea, You can use a 1 dimension texture and fill it with your false colors. The size of this texture depend how many color you want. If the value of each pixel in your video is in the range [0 255], normalize it to be in the range [0 1]. Then you can use the normalize value as texture coord of the 1D texture.

Use nearest filter for the texture.

dletozeun
09-18-2008, 07:10 AM
look at the pixel buffer object (http://www.opengl.org/registry/specs/ARB/pixel_buffer_object.txt) extension to benefit from from DMA while updating data.

http://www.songho.ca/opengl/gl_pbo.html