SFML community forums

General => Feature requests => Topic started by: Kalero on April 19, 2008, 02:22:47 pm

Title: Z order
Post by: Kalero on April 19, 2008, 02:22:47 pm
Hello,
can you integrate in sf::Sprite a Methode for the Z order, please?

It would be very nice ^_^
Title: Z order
Post by: Laurent on April 19, 2008, 05:18:14 pm
What would be the point of adding such things into SFML ? Just do it on your side ;)
Title: Z order
Post by: Kalero on April 19, 2008, 05:33:31 pm
If I doing it by Software, I think it's many work and not good for Performance.

Or can I use only the Depth Buffer from OpenGL and do all other by SFML?
Title: Z order
Post by: Laurent on April 19, 2008, 06:02:44 pm
You don't need a Z-buffer to do this, just sort your sprites by depth so that they are rendered in the right order.
Title: Z order
Post by: Kalero on April 19, 2008, 06:14:39 pm
I mean this. But I mean, that I dont want sort the Sprites by Software.
I think its easyer, if SFML use intern Depth test, and you can sort the Sprites by a Z Coord.

I hope, you understand, what i mean. my English is terrible ^_^'
Title: Z order
Post by: Laurent on April 19, 2008, 06:21:01 pm
Sorting one array of pointers won't hurt your performances, if it's what you're afraid of... ;)
Title: Z order
Post by: Kalero on April 19, 2008, 06:22:32 pm
okay, then I do it so.
But I think its a very usefull think ^_^
Title: Z order
Post by: aisman on April 19, 2008, 06:56:44 pm
Quote from: "Kalero"
But I think its a very usefull think ^_^

No not really. Sorry.
Title: Z order
Post by: eleinvisible on April 19, 2008, 08:46:59 pm
Just have an integer to sort which order to draw them in then sort them all? That is what I would do... Adding a Z element would add not necessary complexity to a Simple & Fast Library.
Title: Z order
Post by: Kalero on April 19, 2008, 09:34:03 pm
Quote from: "eleinvisible"
Adding a Z element would add not necessary complexity to a Simple & Fast Library.


Sorry, but this is not right. Its much easyer, because you must give the sprites only a Z coord and you can draw the Sprites in order how you want....The Graphic Card draw it ever with the right Z-order.

And that is much easyer, as to write a function, what must sort the Sprites, in the right order.  :wink:
Title: Z order
Post by: aisman on April 19, 2008, 09:54:26 pm
Quote from: "Kalero"
Quote from: "eleinvisible"
Adding a Z element would add not necessary complexity to a Simple & Fast Library.


Sorry, but this is not right. Its much easyer, because you must give the sprites only a Z coord and you can draw the Sprites in order how you want....The Graphic Card draw it ever with the right Z-order.

And that is much easyer, as to write a function, what must sort the Sprites, in the right order.  :wink:

Only if your order will be never changing ;-)

And if it not changing...so iit is easy to work without z-order:
Draw the 'behindest' sprite first...then the next and at least the sprite which is the nearest to you ;-)
Title: Z order
Post by: Kalero on April 19, 2008, 10:04:39 pm
Quote from: "aisman"
Only if your order will be never changing ;-)

And if it not changing...so iit is easy to work without z-order:
Draw the 'behindest' sprite first...then the next and at least the sprite which is the nearest to you ;-)


I think you have don't complett understand what I have write
If the the order never changing, you don't need everything for the Z-order  :wink:
Title: Z order
Post by: tgm on April 19, 2008, 11:07:35 pm
besides there ist a problem with every transparent Sprite.. (zBuffer is either set to the sprites Z, or not) So a half transparent sprite would blow up the entire system..
Title: Z order
Post by: aisman on April 19, 2008, 11:13:50 pm
Quote from: "Kalero"
If the the order never changing, you don't need everything for the Z-order  :wink:

I think you knows what I mean. Thats all.
Title: Z order
Post by: Kalero on April 19, 2008, 11:16:44 pm
Quote from: "tgm"
besides there ist a problem with every transparent Sprite.. (zBuffer is either set to the sprites Z, or not) So a half transparent sprite would blow up the entire system..


that is right, but if you disable the Depth Buffer for this time it should be work.
Title: Z order
Post by: tgm on April 20, 2008, 05:19:24 pm
but then again Z sorting via Z position won't work ;)
Than your exacly at the current position -> you have to render em in the right order^^
Title: Z order
Post by: Kalero on April 20, 2008, 05:34:29 pm
Quote from: "tgm"
but then again Z sorting via Z position won't work ;)
Than your exacly at the current position -> you have to render em in the right order^^


Sorry, I don't understand what you mean.
For some times I have do it like this in OpenGL, and it all works fine.
Title: Z order
Post by: tgm on April 20, 2008, 06:22:33 pm
If you turn of Zbuffering, you will have to render em in the proper back to front order. (start drawing the lowest one, and going on with the higher ones..) otherwise the one last drawn would appear to be the highest one.