I’m want transfer float data in a NPOT texture 2d, in NVIDIA glTexSubImage2D works fine, but in ATI not.
// transfer data to texture
glTexSubImage2D(GL_TEXTURE_2D,0,0,0,vImgSize,vImgSize, GL_RGBA, GL_FLOAT,data);
Somebody would be able to say me how in ATI does this?
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.
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.
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.
I’m using the follow texture internal format:
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.
And the questions remain.
What is TEX_TARGET, TEX_TYPE, and vImgSize?
Sorry, the TEX_TARGET is GL_TEXTURE_2D, the TEX_TYPE is GL_RGBAF32_ARB and vImgSize is 55