I want to render big, izometric map. I am using OpenTK and aiming for OpenGL 3.3. Perfect option would be to draw 512x512 map of tiles, which is 262144 blocks -> 524288 triangles. The map is divided into chunks, mostly static but animations would be nice. I was trying to do this in some ways already:
-
Using Geometry Shader to generate chunk. I know its not what GS is for, but it seems to be fast. And it was. Problem is, that i have to send all blocks data to GPU every frame, becouse there is no way I can think of to buffer this on GPU (Uniform Buffers have very restricted limits for reasons I dont understand so I can’t use it). That created a bottleneck on dedicated GPUs, althought with integrated GPUs for obvious reasons it worked well.
-
Calculating position of every block once, store it on VBO (UVs and Vertices) and than draw with BindVertexArray and DrawArrays. The problem was for 256x256 map integrated GPU was using >1500 MB for some reason and was giving me Out of memory. Same for 512x512 with dedicated. According with my calculations it should take only 4 MB (524288 floats) but it didn’t. Even for small numbers like 144x144 blocks it was drawing with ~20FPS…
-
(Done only early, with MonoGame) Render each Chunk to texture (what with FBO on OpenGL?) and than draw needed textures to the screen. But that is ridiculous memory wise and wont work for higher textures resolution.
At this moment Im out of ideas, searching web didnt get me any reasonable solution. I wanted to see how its done in OpenTTD since its open source (its doing exactly what I need), but I have not understand much from its bizzare and complicated code.
Sorry for bad English, it’s not my first language.