SFML community forums
Help => Graphics => Topic started by: krikri on July 05, 2012, 07:23:59 am
-
Good night...
I read this topic (http://en.sfml-dev.org/forums/index.php?topic=5754.0) and I have the same question about Z axis default value on sfml 2.0
Thanks..
-
I'm not going to re-read the other thread, so please just ask your question ;)
There's no Z value in SFML because it's 2D, so what do you mean?
-
I am using the OpenGL lighting system in SFML.
I am aware that SFML is 2D, but must have a z-value.
-
It has no explicit Z-value, it sends 2D positions (see sf::Vertex) to the graphics card. I guess Z is then set to 0, but it doesn't matter anyway because SFML disables depth testing and writing.
-
Z is automatically set to zero by OpenGL. If you apply a transformation to a 2D primitive it can still end up behind another 3D primitive. If you apply a uniform scaling matrix to a 2D primitive it stays in the same X-Y plane.
Internally all vertices in OpenGL posses 4 coordinate values, x, y, z and w. When not specified z is set to 0 and w set to 1. If you want to know what the w coordinate is used for read up on homogeneous coordinates. Even if z and w are not in use, hardware is designed to perform math on matrices and vectors with 4 rows/columns/coordinates, so omitting them during vertex specification is done only to reduce memory bandwidth usage.