Hello guys, now I’m working at a voxel based game(not a Minecraft clone) in LibGDX. All the blocks have the same texture but different colors.
There are some special “blocks” too(they aren’t cubes). I read them from an obj file and use a 10x10 heightmap for collision.
Here’s how my engine renders the map:
-read map data from a file
-build a huge ModelInstance:
-the map is divided into 16x16x16 chunks
-generate a MeshPart for each chunk, using MeshPartBuilder
-apply colors and texture coordinates to each triangle
-start the rendering loop
I’ve recently learned GLSL (it’s great!) and I thought that adding shaders to my ModelInstance/MeshParts would make my game look much better.
My question is: What is the easiest way to bind a ShaderProgram to a ModelInstance, MeshPart or Mesh? Please include some code to make me understand better if you can
Any help is much appreciated