PDA

View Full Version : problems moving from arb_texture_rectangle to arb_npot



shelll
03-05-2006, 01:34 AM
my application is runnig fine with arb_texture_rectangle, but to run it on an ATi card i must switch to arb_npot. it is runnig almost perfect, except of the reduction code :(

i am rendering to 2048x2048 GL_RGBA16F_ARB texture (only to red channel) and after that i want the max value from it. i implemented it through reductions and arb_texture_rectangle code works perfect, but the arb_npot code returns bad values. first 2-3 iterations are ok, but then the max value is smaller and smaller.

here is the shader:

uniform sampler2D tex;
void main() {
vec4 data;
data.x = texture2D(tex, gl_TexCoord[0].st).x;
data.y = texture2D(tex, gl_TexCoord[0].st + vec2(-1.0 / 2048.0, 0.0)).x;
data.z = texture2D(tex, gl_TexCoord[0].st + vec2(-1.0 / 2048.0, -1.0 / 2048.0)).x;
data.w = texture2D(tex, gl_TexCoord[0].st + vec2( 0.0, -1.0 / 2048.0)).x;
gl_FragColor.x = max(max(data.x, data.y), max(data.z, data.w));
}and here the quad rendering:

glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f);
glVertex3f(0.0f, 0.0f, -0.5f);

glTexCoord2f(vWidth / 2048.0f, 0.0f);
glVertex3f((vWidth > 1) ? vWidth >> 1 : vWidth, 0.0f, -0.5f);

glTexCoord2f(vWidth / 2048.0f, vHeight / 2048.0f);
glVertex3f((vWidth > 1) ? vWidth >> 1 : vWidth, (vHeight > 1) ? vHeight >> 1 : vHeight, -0.5f);

glTexCoord2f(0.0f, vHeight / 2048.0f);
glVertex3f(0.0f, (vHeight > 1) ? vHeight >> 1 : vHeight, -0.5f);
glEnd();the only difference is, that i normalize the texcoords. where could be error? it looks like some rows/columns are skipped :(

gf6600gt, 81.85, xp sp2


ps: if ATi will implement arb_texture_rectangle extensions, then life will be much easier in gpgpu world. i know, that ATi is only for npot and there is no way they will implement arb_texture_rectangle :( ((

shelll
03-05-2006, 07:02 AM
ok,

sorry, it was my mistake :rolleyes:

...the first texture in ping-ponging is double the size, so first iteration have different normalized texcoords (can't happen with rectangles)

but i have another problem with FBO :( ( i have one big FBO with attached texture with screen size dimensions. i have window and when i resize it, the app some times hangs :( when the window has small dimensions, resizing is ok, but when i have bigger window, then the app hangs. it hangs always on different sized window. sometimes on smaller, sometimes on bigger window. but the window is always smaller then FBO's texture. i even tried to have bigger window then FBO's texture and it didn't hang! why can be that?

the app didn't hange with arb_texture_rectangle, only with texture_2d (for debug purpose i used POT textures)