 |
|
| Computers Forum Index » Computer - Graphics - API (Opengl) » GL_RG_INTEGER... |
|
Page 1 of 1 |
|
| Author |
Message |
| Nicolas Bonneel... |
Posted: Thu Oct 22, 2009 9:12 pm |
|
|
|
Guest
|
Hi,
I tried using 32 bits integer RG textures and use them in a shader, but
I don't get meaningful values in my shader (if I just replace GL_RG32I
by GL_RG32F, GL_RG_INTEGER by GL_RG, GL_INT by GL_FLOAT, and my int* by
a float* it works properly without any other changes neither in the code
nor in the shader).
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/ |
|
|
| Back to top |
|
|
|
| Nicolas Bonneel... |
Posted: Thu Oct 22, 2009 9:52 pm |
|
|
|
Guest
|
Nicolas Bonneel a écrit :
Quote: I have a GTX280 and OpenGL 3.1.
I just tried updating my driver (now with OpenGL 3.2), using
UNSIGNED_INT instead and SHORT also, but they all fail.
--
Nicolas Bonneel
http://www-sop.inria.fr/reves/Nicolas.Bonneel/ |
|
|
| Back to top |
|
|
|
| Nicolas Bonneel... |
Posted: Fri Oct 23, 2009 4:54 am |
|
|
|
Guest
|
| I also add that glGetError() after that returns 0 (so, there is no error) |
|
|
| Back to top |
|
|
|
| fungus... |
Posted: Fri Oct 23, 2009 8:52 am |
|
|
|
Guest
|
On Oct 22, 7:12 pm, Nicolas Bonneel <Nicolas.Bonn... at (no spam) sophia.inria.fr>
wrote:
Quote: Hi,
I tried using 32 bits integer RG textures and use them in a shader, but
I don't get meaningful values in my shader (if I just replace GL_RG32I
by GL_RG32F, GL_RG_INTEGER by GL_RG, GL_INT by GL_FLOAT, and my int* by
a float* it works properly without any other changes neither in the code
nor in the shader).
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 ?
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. |
|
|
| Back to top |
|
|
|
| Nicolas Bonneel... |
Posted: Fri Oct 23, 2009 2:39 pm |
|
|
|
Guest
|
fungus a écrit :
Quote: On Oct 22, 7:12 pm, Nicolas Bonneel <Nicolas.Bonn... at (no spam) sophia.inria.fr
wrote:
Hi,
I tried using 32 bits integer RG textures and use them in a shader, but
I don't get meaningful values in my shader (if I just replace GL_RG32I
by GL_RG32F, GL_RG_INTEGER by GL_RG, GL_INT by GL_FLOAT, and my int* by
a float* it works properly without any other changes neither in the code
nor in the shader).
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 ?
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
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).
--
Nicolas Bonneel
http://www-sop.inria.fr/reves/Nicolas.Bonneel/ |
|
|
| Back to top |
|
|
|
| Timo Kunze... |
Posted: Fri Oct 23, 2009 9:43 pm |
|
|
|
Guest
|
IIRC, you can't access integer textures with float texture coordinates.
If you want to use integer textures, you also have to use integer
texture coordinates (and the appropriate texture access functions).
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." |
|
|
| Back to top |
|
|
|
| fungus... |
Posted: Sat Oct 24, 2009 11:30 am |
|
|
|
Guest
|
On Oct 23, 7:43 pm, Timo Kunze <TKunze71... at (no spam) gmx.de> wrote:
Quote: IIRC, you can't access integer textures with float texture coordinates.
If you want to use integer textures, you also have to use integer
texture coordinates (and the appropriate texture access functions).
I haven't tried it but I don't believe this - makes
no sense.
--
<\___/>
/ O O \
\_____/ FTB. |
|
|
| Back to top |
|
|
|
| Nicolas Bonneel... |
Posted: Sat Oct 24, 2009 3:05 pm |
|
|
|
Guest
|
Timo Kunze a écrit :
Quote: IIRC, you can't access integer textures with float texture coordinates.
If you want to use integer textures, you also have to use integer
texture coordinates (and the appropriate texture access functions).
Timo
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 |
|
|
| Back to top |
|
|
|
| Timo Kunze... |
Posted: Sun Oct 25, 2009 1:15 am |
|
|
|
Guest
|
Have a look at specifications of EXT_gpu_shader4. On page 26, there's a
table which combinations are supported. You cannot access integer
textures with a float sampler - at least not with EXT_gpu_shader4.
I tried something similar some months ago: Access a foat rg texture with
integer coordinates. I failed for the same reason.
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." |
|
|
| Back to top |
|
|
|
| Nicolas Bonneel... |
Posted: Sun Oct 25, 2009 5:16 am |
|
|
|
Guest
|
Timo Kunze a écrit :
Quote: Have a look at specifications of EXT_gpu_shader4. On page 26, there's a
table which combinations are supported. You cannot access integer
textures with a float sampler - at least not with EXT_gpu_shader4.
I tried something similar some months ago: Access a foat rg texture with
integer coordinates. I failed for the same reason.
Timo
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! |
|
|
| Back to top |
|
|
|
| Nicolas Bonneel... |
Posted: Tue Oct 27, 2009 3:49 pm |
|
|
|
Guest
|
Nicolas Bonneel a écrit :
Quote: Timo Kunze a écrit :
Have a look at specifications of EXT_gpu_shader4. On page 26, there's a
table which combinations are supported. You cannot access integer
textures with a float sampler - at least not with EXT_gpu_shader4.
I tried something similar some months ago: Access a foat rg texture with
integer coordinates. I failed for the same reason.
Timo
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).
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).
--
Nicolas Bonneel
http://www-sop.inria.fr/reves/Nicolas.Bonneel/ |
|
|
| Back to top |
|
|
|
|
|
All times are GMT
The time now is Sat Dec 05, 2009 10:04 pm
|
|