PDA

View Full Version : transfer float data to texture in ATI cards



yalmar
08-09-2006, 01:36 PM
Hello,

I'm want transfer float data in a NPOT texture 2d, in NVIDIA glTexSubImage2D works fine, but in ATI not.

glBindTexture(GL_TEXTURE_2D,tex);
// transfer data to texture
glTexSubImage2D(GL_TEXTURE_2D,0,0,0,vImgSize,vImgS ize, GL_RGBA, GL_FLOAT,data);

Somebody would be able to say me how in ATI does this?

Thanks,

Don't Disturb
08-10-2006, 06:32 AM
If it doesn't work then that probably means the GL_ARB_texture_non_power_of_two extension isn't supported by that graphics card.
Check the extensions string ( glGetString(GL_EXTENSIONS) )to make sure.

If it's not supported then your best bet is probably to make a power-of-two texture larger than the size you need, and glTexSubImage2D into that.

yalmar
08-10-2006, 07:44 AM
I have an ATI X600, it supports NPOT textures, but how tranfer float data to textures in an easy way i don't know. There is a way, is using FBO and glDrawPixels, but this method does not allow to use the FBO for other purpose, for instance, render in texture of different size, and retrieve its data.

Korval
08-10-2006, 12:27 PM
glTexSubImage2D(GL_TEXTURE_2D,0,0,0,vImgSize,vImgS ize, GL_RGBA, GL_FLOAT,data);Is this actually legal, sending float image data with an integral texture format?

Humus
08-10-2006, 02:33 PM
What integral texture format? That's a subimage call, so the internal format used is that of the destination texture. From the code posted here we don't know what internal format is used, but I would assume it's floats.

Either way, it's legal to pass floats to fixed point formats. That has been in the API long before floating point formats were added. It will of course be clamped though.

As for NPOT, check for GL2.0 instead of the extension unless you need the full specification with mipmaps and GL_REPEAT.

yalmar
08-10-2006, 09:44 PM
I'm using the follow texture internal format:
glBindTexture(TEX_TARGET, tex);
glTexParameteri(TEX_TARGET, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(TEX_TARGET, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(TEX_TARGET, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(TEX_TARGET, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexImage2D(TEX_TARGET, 0, TEX_TYPE, vImgSize, vImgSize, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);

but in ATI the glTexSubImage2D doesn't work, the texture data simply has (0, 0, 0, 0) for all texels.

Relic
08-11-2006, 01:09 AM
And the questions remain.
What is TEX_TARGET, TEX_TYPE, and vImgSize?

yalmar
08-11-2006, 12:58 PM
Sorry, the TEX_TARGET is GL_TEXTURE_2D, the TEX_TYPE is GL_RGBAF32_ARB and vImgSize is 55