PDA

View Full Version : Sharing image data between textures



Soth
02-06-2008, 12:45 PM
I want to have different texture object states(like filtering, wrap mode etc.) for the same image.Is it possible to share image data between different texture objects, or i have to use one tex object and set parameters manually when the object is bound ?

-NiCo-
02-06-2008, 12:50 PM
Sure, it's the same as basic multitexturing. Just pass the same identifier to glBindTexture for different texture units.

N.

Korval
02-06-2008, 01:09 PM
Sure, it's the same as basic multitexturing.

No, it is not. He's talking about having the same texture object bound to different multitextures, but with different TexParameter's.

As far as I am aware, if you bind a texture and change its parameters, those parameters get changed, no matter where they are. I think.

You should be able to test this easily enough. Switch to texture unit 0. Bind the texture. Set a parameter to a known value X. Switch to texture unit 1. Bind the same texture. Set the same parameter to known value Y. Switch back to texture unit 0. Get the parameter. If the value of the parameter is X, then you know that the texture parameters can be changed as you suggest (and it would be very strange). If the value is Y as I suspect, then you cannot do what you are trying to do.

-NiCo-
02-06-2008, 01:16 PM
Even without using shaders I've been able to bind the same texture to two units where I set the texture_base_level to different values so that it sampled the same texture at different mipmap levels.



Should the texture LOD bias be settable per-texture object or
per-texture stage?

RESOLUTION: Per-texture stage. This matches the Direct3D
semantics for texture lod bias. Note that this differs from
the semantics of SGI's SGIX_texture_lod_bias extension that
has the biases per-texture object.

This also allows the same texture object to be used by two different
texture units for different blurring. This is useful for
extrapolating detail between various levels of detail in a
mipmapped texture.


So the filtering operations would be per texture object then?
This really makes me wonder whether this is possible in Cg using sampler states...

N.

knackered
02-06-2008, 02:06 PM
Sanity check.
A texture object consists of image data and texture parameters. Anything set with glTexParameter is stored in the texture object. Anything set with glTexEnv is stored in the currently active texture stage.
So no, you can't separate parameters from image data. Not yet, anyway. ;)

Soth
02-06-2008, 03:58 PM
Thanks for replies, it seems i`ll have to call glTexParameter`s every time i bind a texture, until gl3 comes.