View Full Version : magnification filter and shaders

07-17-2007, 02:52 PM

Rendering a primitive using a 8x8 texture specified with a linear magnification filter containing some fairly smooth values; the fixed pipeline generates a nice smooth color across the surface, but when using a simple cg or glsl shader, which does nothing but looking up the texture value and using it as output the result is rather blocky. screenshot (http://www.blacksmith-studios.dk/forumpost/fixedpipelinevsshader.JPG)

The texture is specified with the following parameters:
Target = GL_TEXTURE_2D, format = GL_RGB, wrap = GL_CLAMP_TO_EDGE

Changing the shader profile does not correct this! Does anyone know what limitation I am facing?

- Hel

07-17-2007, 03:19 PM
This looks like these problems :
http://www.opengl.org/discussion_boards/ubb/ultimatebb.php?ubb=get_topic;f=11;t=001431;p=1#000 000

Maybe there is something fishy there...

07-17-2007, 09:38 PM
Don't use GL_RGB as it can be any precision. Use GL_RGB8 instead.

07-18-2007, 01:28 AM
Thank you humus,

Although it did not correct my problem, it showed me how naive I had been! My shader was multiplying the 8 bit channels with an uniform constant, which increased the inevitable numerical errors! When I changed the internal format to GL_RGB_FLOAT16_ATI it worked just fine. The nice thing about 16 bit floating point textures is that they support filters.

07-18-2007, 03:15 AM
Originally posted by Hel:
The nice thing about 16 bit floating point textures is that they support filters. Filtering of floating point textures is not supported on ATI hw older than R600 (Radeon HD Radeon HD 2x00 family) so you need to filter manually in the shader if you wish support X1x00 and older hw.