Drawing large landscape

Started by
-1 comments, last by IceCave 9 years, 8 months ago

Hi,

I am working with the latest OpenGL "ES" - Version but I guess you can also refer to normal OpenGL 3/4.

I want to draw a really big 2D texture as big as possible as a landscape for a 2D-game.

However I don't really know how I could possibly reach the best performance for this task.

I decided that creating a tile-based-landscape is maybe a pretty good solution.

This is what I have tried so far:

=> Drawing every single tile by changing model matrix, texture nd other states and call the draw-function.

- Pro: Really basic, portable and expandable

- Con: Poor performance or a really small map

Other ideas I have:

=> Using a 1024x1024 framebuffer to draw all those single tiles on and draw those framebuffers on the screen.

- Pro: Basically the first idea with better perfomance (depending on the size of a single tile)

- Con: Maybe poor perfomance if there are dynamic background objects on the map, idk.

=> Using a fragment shader. Give him a texture-array with all tile-textures and an integer-array(texture-ids) to compute and draw the map dynamically every frame.

- Pro: Possibly really dynamic and easy

- Con: Maybe poor performance because the shader needs to be replaced every frame and back again, sending the whole map(integer-array) to the gpu needs maybe to much time and drawing the whole map maybe slows down shader.

This is a hobby project and I don't really have time besides work to experiement around with every idea I have.

What do you think is propably the best solution for my problem or do you have another idea?

Thank you very much in advance

IceCave

This topic is closed to new replies.

Advertisement