• Advertisement
Sign in to follow this  

Texture Flickering issue

This topic is 1463 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Good evening lads,

 

Recently i've stumbled upon one issue that is starting to drive me angry.

Textures in game have flickering edges. I even resorted to simple tests.

 

Here is a video of my issue 

http://www.youtube.com/watch?v=6WERdhhEgdI

 

As you can see, edges of circle become flat and round again and again.

 

I am using LibGdx for "faster" development cycle.

 

Texture loading looks like this

Spr = new Sprite(new Texture(Gdx.files.internal("data/imgs/img.png")));
Spr.getTexture().setFilter(TextureFilter.Linear, TextureFilter.Linear);

If i change filtering to "Nearest" it "does" the trick, but then i can't scale image properly. It becomes pixelated.

 

I made a screenshot from game and slapped my texture a top, it seems that unneeded pixels are drawn.

 

problim.png

 

 

Maybe someone has any ideas where to search for a solution?

Maybe its not even "flickering" and has some other term to it?

Edited by Sollum

Share this post


Link to post
Share on other sites
Advertisement

A few things I can think of:

- does your texture go right up to the edge of your geometry? If so, try leaving a little space near the edges

- "unneeded pixels are drawn": Does your circle texture have a smooth alpha gradient around the circle (i.e. is it anti-aliased)? If so, it might mean that you're drawing the texture completely opaque for anywhere where (alpha > 0). That's the first thing that comes to mind when you say unneeded pixels are drawn. What blending modes are you using when drawing? (I'm not familiar with LibGdx, so I don't know what it supports).

Share this post


Link to post
Share on other sites

My guess: by the non-smooth borders of the black circle => blending mode and/or alpha testing issue.

 

As there is not enough source provided (don't know anything about LibGdx either) - the only advice i can give is: "fix whatever is broken there" :/

Share this post


Link to post
Share on other sites

I am not sure how the drawing works in general, but if i use part of texture (textures are "power of two") then sometimes i get black line at the edge when moving my object.

 

Blending mode is enabled together with depth test

Gdx.gl.glEnable(GL10.GL_BLEND);
Gdx.gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
Gdx.gl.glEnable(GL10.GL_DEPTH_TEST);

I guess ill check other open source projects made with LibGdx and see how they do it.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement