PDA

View Full Version : Texture rectangle and floating point buffers



Benji31
09-18-2003, 01:02 PM
I am hopelessly trying to run floating points textures. I use the instruction
TEX R0,f[TEX0],TEX0, 2D;
in the fragment program, but the wrong texture is accessed if I specify GL_TEXTURE_RECTANGLE_NV instead of TEXTURE_2D and\or if I replace GL_RGBA by GL_FLOAT_RGBA32 in teximage2d that is in the program below:

glActiveTextureARB (GL_TEXTURE0_ARB);
glBindTexture(GL_TEXTURE_2D, g_textureID);

float text_32[16*16*4];
for (int i=0;i<16*16*4;i++)
text_32[i]=0.3+(((float) (i%8))*0.1);
LoadFragProgramNV("fprogramCopyNV.frag");
glEnable(GL_FRAGMENT_PROGRAM_NV);
glEnable(GL_TEXTURE_2D);
glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA,16,16,0,GL_RG BA,GL_FLOAT,text_32);

Texture not seems to be loaded in the wrong cases, but I can retrieve the textures using getteximage. I use a FX 5200GO

jra101
09-18-2003, 01:18 PM
Replace this:

TEX R0,f[TEX0],TEX0, 2D;

with this:

TEX R0, f[TEX0], TEX0, RECT;

when doing a texture fetch from a rectangle texture.

NitroGL
09-18-2003, 01:18 PM
Did you change the texture target in the fragment program too? (from 2D to RECT)

Benji31
09-18-2003, 01:38 PM
Thank you guys,
I am so stupid some times...
I knew that I did not understand very well how acts the tex instruction in the spec, but I did not thought it was that...
Thank a lot once again...