Fps drop when viewing chunks from different positions

Hi, I have a problem with my chunk rendering system.

I have a class that allows me to create chunks. To do so I simply store in a variable a Chunk object and then in my Renderer.java I render it.

The problem is: when I see the chunks from a certain position, all runs smoothly. But when I try to look behind me, I experience an enormous fps drop.

Screenshots:

This is normal

This is when I try to look behind me. (Note the lag)

What did I wrong? I’m new to the OpenGL world :frowning:

If you need some other code please tell me.

Thanks in advance

Chunk.java (http://pastebin.java-gaming.org/70ac744880116)
Renderer.java (http://pastebin.java-gaming.org/0ac745881061e)

You have a different amount of overdraw when viewing from different directions. This shows you are fillrate limited. Solution involves zooming out :stuck_out_tongue: or ‘optimizing’ the order of the cubes in your chunk, sorting them coarsely front to back, once every N frames.

Thanks for your reply, now I finally figured out the problem!

Do you have any example on how to “coarsely sort the cubes front to back”?

Thank you

I’m the creator of the tutorials you are watching (pancakesimone on YouTube), and I have to say that my tutorials are very outdated and shouldn’t be followed. I used horrible coding practices, and old deprecated functions of OpenGL.

Sorry about that.

Hi opiop, I’m happy to see your reply. Your tutorials are a lot useful and well-explained, so I used to watch them from the beginning of my “opengl adventure”.

In your pc the code was working perfectly, but why not in mine?
Do you have some suggestions/examples? Thank you.

P.S. Sorry for the bad english men :stuck_out_tongue:

It’s probably just that his graphics card is more powerful than yours.

Yes, it’s very probable… If anyone has a suggestion, please tell me. I’m going crazy.