GabrielBianco
04-22-2007, 09:57 AM
I'm trying to find a way to render a full screen quad with a large texture and have the pixels go through a simple transformation. The variables used for the transformation are changed dynamically, so we need to reapply the transformation every time they are changed.
I know of a few ways to do it:
1) Apply the transformation to the texture.
This is what we do right now, but the texture is pretty big. It takes about 50ms and after that we still have to delete the old texture and send the new one to the graphics card.
2) Use a pixel shader.
Can't do it... It has to run on graphics cards that are pretty old. No extensions can be used.
3) Use a pixel map.
The idea is the same as what we would use with the pixel shader. Instead of updating the large texture, we change the palette (color look up table) and then render using this palette.
http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pixelmap.html
Setting a pixel map only affects a few functions (glCopyPixels, glCopyTexImage1D, glCopyTexImage2D,glCopyTexSubImage1D, glCopyTexSubImage2D, glDrawPixels,glReadPixels, glTexImage1D, glTexImage2D, glTexSubImage1D,and glTexSubImage2D). Regular rendering (glBegin, glVertex, glEnd) is not affected.
The problem with this approach is that it is very slow (it's probably not HW accelerated).
Does anyone know different ways to do it (can't be slower than looping through the whole big texture, can't use extensions)?
I know of a few ways to do it:
1) Apply the transformation to the texture.
This is what we do right now, but the texture is pretty big. It takes about 50ms and after that we still have to delete the old texture and send the new one to the graphics card.
2) Use a pixel shader.
Can't do it... It has to run on graphics cards that are pretty old. No extensions can be used.
3) Use a pixel map.
The idea is the same as what we would use with the pixel shader. Instead of updating the large texture, we change the palette (color look up table) and then render using this palette.
http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pixelmap.html
Setting a pixel map only affects a few functions (glCopyPixels, glCopyTexImage1D, glCopyTexImage2D,glCopyTexSubImage1D, glCopyTexSubImage2D, glDrawPixels,glReadPixels, glTexImage1D, glTexImage2D, glTexSubImage1D,and glTexSubImage2D). Regular rendering (glBegin, glVertex, glEnd) is not affected.
The problem with this approach is that it is very slow (it's probably not HW accelerated).
Does anyone know different ways to do it (can't be slower than looping through the whole big texture, can't use extensions)?