Results 1 to 3 of 3

Thread: Texture Flickering on the Right Side of the Screen

  1. #1

    Texture Flickering on the Right Side of the Screen

    I have Sprites in the Size of 64x64. They enter the screen from the right.
    Their initial position is:
    screen_x+size+20
    So they don't spawn in front of the player.
    When they enter the screen on the right, I get a texture flickering. I have made a screenshot to explain things:
    http://img838.imageshack.us/img838/2503/samplej.png
    The red line from top to bottom shows where the Flickering is. It is on the right side of this line. The red quad on the sprite shows which part of the texture is flickering. I hope that describes my issue well enough.

    The sprites are png texture with transparency. I do an alpha test inside a shader to render them.
    Code :
    if ( col.a >= 0.1f ) 
        discard

    The Background consists of 2 Layers which are scrolled along their x-texture-coords inside another shader.

    The textures are generated either with GL_CLAMP_TO_EDGE or GL_REPEAT, depending on the usage of the texture. Currently, only the backgroun images are generated with GL_REPEAT.
    All sprites use different z-values, in 0.1f steps to avoid z-fighting.
    Orthographic view has a z-near of -1.0f and a z-far of 1.0f.

    I hope that covers all informations. If you need more let me know please. Thanks.

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: Texture Flickering on the Right Side of the Screen

    Do you know the Shannon/Nyquist sampling theorem ?
    http://en.wikipedia.org/wiki/Nyquist%E2%...nals_and_images

    You have 2 ways of solving it :
    - make everything pixel exact : GL_NEAREST sampling, positions in whole pixel integer increments
    OR :
    - prefilter your texture data so that the changes in texture are not so sudden (so the 'frequency' of color changes is low enough for per pixel sampling) -> it means blur a bit your images. 1-pixel wide gaussian should be enough, try different values.

    EDIT : I see there is a suspicious white line all around your sprite, which probably exagerate the problem. GL_NEAREST will avoid the white to bleed around, if it has alpha=0.

  3. #3

    Re: Texture Flickering on the Right Side of the Screen

    Hi ZBuffeR.
    Thanks for your reply. I feel kinda dumb not to thought about GL_NEAREST. That solved the problem entirely and also the white line around my sprites.
    Thanks a Ton.

Similar Threads

  1. Flickering Screen / Questions
    By PadMad in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 01-12-2016, 02:09 AM
  2. Server side off-screen rendering with basic GL
    By M/\dm/\n in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 02-19-2008, 08:08 AM
  3. why only one side of image show on the screen?
    By havana in forum OpenGL: Advanced Coding
    Replies: 5
    Last Post: 01-08-2003, 08:16 AM
  4. flickering screen
    By in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 02-22-2002, 07:11 PM
  5. Screen Flickering
    By matt8594 in forum OpenGL: User Software
    Replies: 0
    Last Post: 01-27-2002, 03:05 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