Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In a game I'm making in LibGdx, I wish to incorporate a ripple effect. I'm confused as to how I get access to the individual pixels on the screen, or any way to influence them (apart from what I can do with sprite batch).

I have my suspicions that I have to do it through openGL, and it has something to do with apply a mesh? This brings me to my question, what exactly is a mesh?

I've been working on my game for about half a year, and am doing great with the other aspects of the game, but I find this more advance stuff isn't as well documented.


share|improve this question

You seem to be REALLY confused about things, so i'll try to break it down for you.

A mesh is just a collection of points/triangles in space. It's used interchangably with the term model and usualy means the same thing.

You don't get access to individual pixels on the screen itself, what you can do is access them before they're put on the screen, if that makes sense. OpenGL allows rendering to a, so called, frame buffer, it's like rendering to an image in memory, this allows you to apply post processing effects. I don't know how libgdx does it though.

Now there are plenty of ways to do ripples and it depends on what kind of an effect you're looking for, though you haven't specified anything. You could just do a ripple animation and blend it with whatever picture you have, you don't need OpenGL for that. Other than that you could put your finished image through OpenGL and let it apply ripples as some sort of a displacement based on a normal map. There's plenty of articles that cover this subject. The issue is that if you don't understand how OpenGL works, then none of this is going to help you, really.

share|improve this answer

If you're using libGDX SpriteBatch, instead of rendering to the screen you should be able to render to a FrameBuffer, then you can get the resulting texture out of that and render it to the screen. You can apply effects to the texture before rendering to get screen-wide effects.

This isn't the most efficient way, but it should be sufficient.

This question over on stackoverflow covers a similar request (for a different reason), but the code example should help you get started:

share|improve this answer
I haven't the slightest clue how to "apply effects" onto a texture. Is there something I'm missing here? I put that snippet in my code and I can't figure out any way to edit the FrameBuffer nor the TextureRegion – Brian Diehr Jul 13 '12 at 0:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.