Results 1 to 2 of 2

Thread: Rendering a textured rectangle diaganol artifact

  1. #1
    Junior Member
    Join Date
    Mar 2012

    Rendering a textured rectangle diaganol artifact

    I'm been writing a text library for webgl and I was noticing some strange artifacting along the diagonal of several of my letters. While trying to investigate this, I rendered out the entire texture containing my letter set (a 256x256 texture) and noticed that it too had an artifact along the diagonal. This of course matches the diagonal that separates the two triangles that compose my rectangle. My rectangle is being drawn by creating a buffer with four points and make a 0,1,2 index and a 0,2,3 index. When I was doing directX work I never noticed a diagonal artifact when rendering a textured rectangle, but I am in this case. Is there some texture sampling setting I need to do to eliminate this?

    My fragment shader is dirt simple:

    precision mediump float;
    varying vec2 vTextureCoord;
    uniform sampler2D uSampler;
    void main(void)
    gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));

    Maybe texture sampler is set up wrong:

    gl.uniform1i(manta.m_render.m_shaderMgr.m_hudTextu reShader.samplerUniform, 0);

    Any info would be greatly appreciated, thanks

  2. #2
    Junior Member
    Join Date
    Mar 2012

    Re: Rendering a textured rectangle diaganol artifact

    Just as one more data point I changed my text texture from:



    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);

    And while that didn't completely fix it, it did seem to improve it substantially.

Similar Threads

  1. a rectangle as a inclined parallelogram
    By srobles in forum OpenGL ES
    Replies: 4
    Last Post: 05-16-2008, 04:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean