Ah thanks. How exactly does it work though...? I mean to render something under something else, you have to put the Render() call before the second Render() call. How does this function do it?
When you enable the z-buffer (System_SetState with HGE_ZBUFFER, true), then sprites with higher z-values draw above sprites with lower z-values (or lower over higher, I can't remember off the top of my head) regardless of render order.
Usually when i was making my games, I disable HGE_ZBUFFER and just render everything ordered from back to front. This is easy due to the way I'm storing my level data. This gives signifficant speed up on older video cards (back to year 2000).
Heard that modern cards don't give a flying zbuffer, if you enable or disable it, they work almost same fast.
And if you go with enabled zbuffer, it is full 32bit float value in range from 0 to 1, you can go as many layers as you like up to 5-6 or even 7 digits after point.
Yeah but what I'm asking is, how does it technically do it? I mean you'd first do one Render() to render something, and then you'd make another line in your code and add another Render() to put something else on top of the previous thing you rendered.
How exactly does using Z() work? I mean this is run-time when it's called. It can't just change the source code and re-order your lines of code during run-time. That's where I'm confused on. Just how it works.
This is basics of 3D rendering, and since HGE uses Direct3D inside, the principle applies to HGE too.
When you start graphics, your video card creates special buffer in its memory, which contains a depth value for each pixel of screen. When video card renders something, each pixel is compared with its own depth value and is either skipped completely, or written, and depth value is updated.
This works for 3D, but again HGE is based on 3D drawing just with special camera settings, making all drawn stuff to be parallel to the screen plane.