Sign in to follow this  
smay

Texture Rendering Artifacts

Recommended Posts

Hello all, i get curious distortions while scaling textures down to use them as image pyramid. For that i do: 1) Write data from host into a texture buffer (glDrawPixels or glTexSubImage2D). 2) This texture is used for the next scale level. So i apply it and draw a quad with:
glBegin(GL_QUADS);
{
   // draw first scale
   glTexCoord2f(0.0,0.0);
   glVertex3f(-1.0,-1.0,1.0f); // down left

   glTexCoord2f(1.0,0.0);
   glVertex3f(0.0,-1.0,1.0f); // down right

   glTexCoord2f(1.0,1.0);
   glVertex3f(0.0,0.0,1.0f); // up right

   glTexCoord2f(0.0,1.0);
   glVertex3f(-1.0,0.0,1.0f); // up left
}
glEnd();

Please note that glVertex3f is getting parameters for only a fourth of the texture buffer. The rest of the buffer is used for the next scale levels. The data I draw contains only a simple rectangle. I have also applied different scaling filters. In the following image, you see a bilinear kernel applied to the down scale procedure. What i get is a distortion while crossing the diagonal from upper left to down right on each scale level. Distortion while crossing the diagonal I checked the following things: 1) Use of floating point precision (16-bit and 32-bit). No change! 2) Use of own fragment shader (bilinear-, barlett-, gauss-filtering). No change! 3) The data initially written down are precise at all. These effects are appearing after the first scaling. I cannot use mipmaps since i want to control the build procedure. Do anyone know how this effect can be avoided? Thank's in advance Stefan

Share this post


Link to post
Share on other sites
Quote:
Original post by smay
Please note that glVertex3f is getting parameters for only a fourth of the texture buffer. The rest of the buffer is used for the next scale levels.


Um... Your texture coordinates still go from 0 to 1, so the whole texture is used. glVertex3f only changes the position on screen. Still, I don't know why you get that slice.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this