texture lookup indirection problem

Started by
3 comments, last by karwosts 14 years, 1 month ago
I reformulated my problem because it evolves since the begin of my last thread: I want to do a simple thing: I have a simple texturedquad wich i write texcoords st to an RGBA image in RG components using this simple shader and render to texture: uniform sampler2D unusedTexture; void main(){ gl_FragColor=vec4(gl_TexCoord[0].st,0,1); } it gives me that after that i modify my prog in order to take this image as input texture and modify the shader: uniform sampler2D indexTexture; //texcoord texture void main(){ vec4 pos = texture2D(indexTexture, gl_TexCoord[0].st); take //first indirection: pos has expected values as i tried to output it vec4 col= texture2D(indexTexture,pos.xy); // second indirection: bad lookup output } What I want is the same image as inputTexture since i take pos in a texcoordtexture data that must be the same as gl_TexCoord[0].st but the resulting render is: can you help with this problem? Is this a hardware problem or limitation ? ( I'm working with a Quadro1500M... :( )
Advertisement
I tried the exact same thing on my hardware (nvidia 8800GTS) with your gradient and it works as expected (final image looks exactly like the gradient).

vec2 testuv = texture2D(S_tex,uv).rg;layercolor = texture2D(S_tex,testuv).rgb;


My guess is an issue with your hardware. Maybe doesn't support multiple lookups to same texture? But I have no idea.
[size=2]My Projects:
[size=2]Portfolio Map for Android - Free Visual Portfolio Tracker
[size=2]Electron Flux for Android - Free Puzzle/Logic Game
Erf I have an old Quadro 1500M It may come from that...Damned Hardware
Looks like a problem with texcoords or perhaps mipmaps are not good.
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
You can try querying these values with glGetProgramiv. Not totally clear on what is the difference between a tex_indirection and a native_tex_indirection, but this might give info for you.

PROGRAM_TEX_INDIRECTIONS_ARB 0x8807
MAX_PROGRAM_TEX_INDIRECTIONS_ARB 0x880D
PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x880A
MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x8810

It might not end up being a hardware thing after all, looking at this article it says minimum number of tex indirections for implementation must be greater than 4.

http://www.nvidia.com/dev_content/nvopenglspecs/GL_ARB_fragment_program.txt

[size=2]My Projects:
[size=2]Portfolio Map for Android - Free Visual Portfolio Tracker
[size=2]Electron Flux for Android - Free Puzzle/Logic Game

This topic is closed to new replies.

Advertisement