Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Is there any way that I can control in which order elements are drawn with instancing?

Do all elements get drawn in the same order they are added to the instance buffer?

Edit: What about the Z coordinate! Since I am drawing my GUI through this, I should be able to just put elements in front of others, right? I am not at home to try this out yet. I will keep the thread updated.

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

If you are doing 3D, depth should be drawn according the the z-buffer.

share|improve this answer
add comment

Object are drawn in the order they are sent to the graphics hardware (generally, I don't want to get into nit picky here :)). So to your original question, if those are the instances you are talking about, then yes, the order is obeyed (and becomes very important when dealing with alpha blending for example).

In the realm of 2D GUI/HUDs, I will generally Render the scene, then disable zBuffering and render the HUD using its by-design root to leaf nature to get the proper layering.

Can you use the z value? Yes.. I am just not sure if there are enough polys to really make this a huge concern however. (I have worked in a system that did this, but that was because the GUI was the same system as the Particle System.)

Hope this helps

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.