NPOT reliable?
I'm trying to render a NPOT texture in ortho mode in its original dimensions, and I'm getting some distortion.
(You can see some distortion around the '2' and '6').
My graphics card supports the extension GL_ARB_texture_non_power_of_two, so I am rendering the texture normally
as I would any other texture. I use GL_TEXTURE_2D, GL_NEAREST, and GL_CLAMP_TO_EDGE to set it up.
When I pad the texture myself to powers of 2, this distortion disppears. But I shouldn't have to do this myself
if my card supports NPOT textures.
Just wondering if anyone else has experience the same problem with NPOT textures.
it shouldnt do that,
is the texture mipmapped? (though dont see what difference that could make in ortho projection)
perhaps try rendering the texture at both twice + half the resolution, is the problem still there?
if not perhaps post on opengl.org with a report of what card/drivers youre using
is the texture mipmapped? (though dont see what difference that could make in ortho projection)
perhaps try rendering the texture at both twice + half the resolution, is the problem still there?
if not perhaps post on opengl.org with a report of what card/drivers youre using
Nope, it's not using mipmaps.
I want to render a NPOT texture in its original dimensions, with no stretching, no filtering, no distortion, etc...
I use this to load it:
I want to render a NPOT texture in its original dimensions, with no stretching, no filtering, no distortion, etc...
I use this to load it:
glEnable( GL_TEXTURE_2D ); glBindTexture( GL_TEXTURE_2D, textureID );glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA8, w,h, 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer );glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );// rendering glBegin(GL_POLYGON); glNormal3f( 0.0f, 0.0f, 1.0f ); glTexCoord2i( 0,0 ); glVertex2i( 0,0 ); glTexCoord2i( 0,1 ); glVertex2i( 0,h ); glTexCoord2i( 1,1 ); glVertex2i( w,h ); glTexCoord2i( 1,0 ); glVertex2i( w,0 ); glEnd();
I used to see all kinds of crazy stuff like that when the nvidia control panel settings had the image quality set to high performance. I wasted like a week messing with my code because all my GUI elements were looking shitty, and I thought I was at fault. The slider fixed it all.
Quote:Original post by Daaark
I used to see all kinds of crazy stuff like that when the nvidia control panel settings had the image quality set to high performance. I wasted like a week messing with my code because all my GUI elements were looking shitty, and I thought I was at fault. The slider fixed it all.
You might have something there. But, as far as I know, I'm using all default settings in the Nvidia control panel. I haven't made any changes
myself since I installed the driver.
Image settings is set to: "Let the 3D application decide"Anisotropic filtering: Application-controlledAnisotropic mip filtering optimization: OffAnisotropic sample optimization: OnAntialiasing settings: Application-controlledConformant texture clamp: Use hardwareExtension limit: OffForce mipmaps: NoneGamma correct antialiasing: OffHardware Acceleration: Multiple display performance modeNegative LOD bias: AllowTexture filtering: QualityTransparency antialiasing: OffTrilinear optimization: OnTriple buffering: OffVertical sync: Use the 3D application setting
Would say it's a so called "precision issue" of the hardware. I've encountered exactly the same shitty glitches in a same scenario, unlike in a D3D10 context (using the Load intrinsic, no filter, no mipmap) and on a NV Quadro FX4600.
I did almost the same bypass as you, forcing my texel fetchs to be POTish when generating my screen aligned quad in my geometry shader (then discarding extra fragments with Discard intrinsic in my pixel shader).
That's all... I'm still waiting for doing some more tests on different IHVs boards or drivers...
I did almost the same bypass as you, forcing my texel fetchs to be POTish when generating my screen aligned quad in my geometry shader (then discarding extra fragments with Discard intrinsic in my pixel shader).
That's all... I'm still waiting for doing some more tests on different IHVs boards or drivers...
I added these lines, thinking they might help with NPOT texture widths:
But, nope, it didn't work. Still the same.
glPixelStorei( GL_UNPACK_ALIGNMENT, 1 ); glPixelStorei( GL_PACK_ALIGNMENT, 1 ); glPixelStorei( GL_UNPACK_ROW_LENGTH, (INT)w ); glPixelStorei( GL_PACK_ROW_LENGTH, (INT)w );
But, nope, it didn't work. Still the same.
Quote:Original post by rosewell
I want to render a NPOT texture in its original dimensions, with no stretching, no filtering, no distortion, etc...
Did you try using the GL_ARB_texture_rectangle extension instead?
u shouldnt be using int types eg
glTexCoord2i( 0,1 ); use 2f(0,1);
for one thing I believe u will fall off the fast path.
also theres perhaps rounding errors have a look at opnegl.org in the faq I believe theres info there on how to set up 1:1 mapping
glTexCoord2i( 0,1 ); use 2f(0,1);
for one thing I believe u will fall off the fast path.
also theres perhaps rounding errors have a look at opnegl.org in the faq I believe theres info there on how to set up 1:1 mapping
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement