In what order are the polygons in a VBO drawn?

Started by
1 comment, last by MarkS 14 years, 4 months ago
Yet another tile engine question... Each tile map in my engine is composed of one or more tile layers. The naive way to do this is to draw tile layer 0 (the bottom-most layer) followed by layer 1 and so on by separate calls to glDrawArrays. What I'd much rather do is combine all of them into a single VBO and simply draw that. The problem I see is that since I'm using alpha blending, depth testing is turned off. This precludes me from specifying separate z coordinates for each layer. What I'm wondering is how the array is parsed and drawn. Is it done linearly, from element 0 to element n or by some other method? If I were to set tile layer 0 as elements 0 to a and layer 1 and elements a to b and so on, would the layers be drawn correctly? [Edited by - maspeir on December 29, 2009 3:27:10 PM]

No, I am not a professional programmer. I'm just a hobbyist having fun...

Advertisement
Primitives are drawn from the buffers in the order they appear in the arrays. Your layers would be rendered in the desired order.
Awesome! Thank you!

I could have coded this and found that out, but I sure would have hated to have wasted my time if it didn't.

No, I am not a professional programmer. I'm just a hobbyist having fun...

This topic is closed to new replies.

Advertisement