lwjgl 3 tile rendering code

Started by Peter M Ashford, February 01, 2016, 08:08:30

Previous topic - Next topic

Peter M Ashford

Can anyone point me to a good example of tile rendering using lwjgl3?  I suspect that using a VBO is the way to go I'd just like to see some 'best practice' code if such exists?  I'd rather not reinvent the wheel if someone's already done the ground work =)

Kai

There is not "the" way of doing tile rendering in OpenGL.
It depends on your concrete use cases and requirements:

- How many tiles?
- How big is a tile?
- Does the content of a tile change?
- How often does it change?
- How much of all tiles will/can be visible at the same time? (zoom in/out?)

There are just two major rules that exist with everything you do in OpenGL:
1. Reduce the number of API/draw calls
2. Reduce the amount of data needed to be transferred between client and OpenGL driver/card per frame

Solving 1. leads to batch rendering (possibly via instancing)
Solving 2. leads to using VBOs

Everything else is dependent on your concrete application.