Hi Jonathan,

On Fri, 2005-04-08 at 10:28 -0400, Jonathan Bard wrote:
> 
> Hi everyone,
> I'm back for a new question. This time it's about 32 bits textures. I would 
> like
> to use this kind of texture in a GLSL shader, within OpenSG, of course. Juste
> before spending my time on it, I would like to have a precision. I read
> somewhere that 32bits textures don't work the same way than others in regard 
> to
> interpolation. So, in the shader, must the sampler provide the index of the
> pixel it wants to access, rather than a float between 0 and 1, that indicates
> in a relative way the pixel in the image? Is it really how you access a 32 
> bits
> texture pixel, by specifying the absolute location in the texture?

Not necessarily. Float textures don't have to be like that, but in many
cases they will be, see below.

> Another thing : given that interpolation in the classic texture access works
> with power of 2, is it necessary, in the case of 32 bits textures where 
> there's
> no interpolation, to provide a power of 2 - sized texture?

Ditto.

> Well, that's my questions. From a previous post, I think I understood that you
> just have to provide the pixel type Image::OSG_FLOAT32_IMAGEDATA and to cast
> the float array into a UInt8 array, in order to create such an image. Tell me
> if there's something else I must do (for example, is it necessary to choose a
> particular type of Min/Mag Filteer in the TextureChunk?).

Older nvidia boards can only do float textures with rectangular textures
and with a shader. So to be on the safe side it makes sense to use
rectangular (non power of two) textures (i.e. texchunk->setTarget
(GL_TEXTURE_RECTANGLE_ARB);). For these you need to use texture
coordinates from 0 to width, and you can't use mipmaps. As Jan said, on
most systems you also can't use linear filters, you have to use nearest.
You also have to tell OpenGL (and OpenSG) to keep the float accuracy
internally by setting the internal format (e.g texchunk-
>setInternalFormat(GL_xxx);). 

Hope it helps

        Dirk

-- 
-- Dirk Reiners               OpenSG Forum             [EMAIL PROTECTED] 
-- The OpenSG Open Source Scenegraph:            http://www.opensg.org
-- Join the list at    http://lists.sf.net/lists/listinfo/opensg-users



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to