Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Texture Flickering issue


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Sollum   GDNet+   -  Reputation: 736

Like
0Likes
Like

Posted 18 January 2014 - 05:09 PM

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 

 

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, 18 January 2014 - 05:09 PM.


Sponsor:

#2 phil_t   Crossbones+   -  Reputation: 3945

Like
0Likes
Like

Posted 18 January 2014 - 07:37 PM

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).



#3 tanzanite7   Members   -  Reputation: 1344

Like
0Likes
Like

Posted 19 January 2014 - 03:23 AM

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" :/



#4 Sollum   GDNet+   -  Reputation: 736

Like
0Likes
Like

Posted 19 January 2014 - 03:29 AM

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.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS