to load the texture, I do :
int* pixs = ...;
glTexImage2D(GL_TEXTURE_2D,0,GL_RG32I,w,h,0,GL_RG_INTEGER,GL_INT,pixs );
The values in "pixs" are integers beetween 0 and 1024 (or between 0.f
and 1024.f when I use a float*).
I have a GTX280 and OpenGL 3.1.
Any idea ?
Thanks!
--
Nicolas Bonneel
http://www-sop.inria.fr/reves/Nicolas.Bonneel/
I just tried updating my driver (now with OpenGL 3.2), using
UNSIGNED_INT instead and SHORT also, but they all fail.
I think integer values are divided by 2^32 so they
always represent a number between 0 and 1.
eg. integer 1024 becomes 0.000000238418
--
<\___/>
/ O O \
\_____/ FTB.
mmm, even multiplying with 2^32 in the shader still gives 0. (and even
2^64.. just in case.. which shows that I get strictly 0 in my shader).
Timo
--
www.TimoSoft-Software.de - Unicode controls for VB6
"Those who sacrifice freedom for safety deserve neither."
"Demokratie ist per Definition unsicher. Ihr Schutz entsteht aus der
Überzeugung, dass die demokratischen Kräfte überwiegen und sich – auf
demokratischem Wege – durchsetzen."
I don't see anything else than texture2D, texture2DLod and texture2DProj
to access my textures in the shader... Is there another one specific for
integer textures ?
Why should the textures coordinates be integers ? This means that I
cannot interpolate/filter my texture and I should only use a GL_NEAREST
filtering ?
Thanks
I haven't tried it but I don't believe this - makes
no sense.
I tried something similar some months ago: Access a foat rg texture with
integer coordinates. I failed for the same reason.
isampler2D! :)
thanks! I'll try that!
I hope it's not slower than floating points textures since I wanted to
use that to speedup my code (send my int* directly to the card instead
of converting them to float* before).
thanks!
I just had time to try it today. I confirm that it works and it odesn't
seem to have lost performance...
I just had to replace my sampler2D by an isampler2D. The texture
coordinates remains floats (between 0 and 1 inside the texture).