Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: What is the default z-value on SFML?  (Read 1798 times)

0 Members and 2 Guests are viewing this topic.

krikri

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
What is the default z-value on SFML?
« on: July 05, 2012, 07:23:59 am »
Good night...
I read this topic and I have the same question about Z axis default value on sfml 2.0
Thanks..

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: What is the default z-value on SFML?
« Reply #1 on: July 05, 2012, 08:18:50 am »
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?
Laurent Gomila - SFML developer

krikri

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Re: What is the default z-value on SFML?
« Reply #2 on: July 05, 2012, 09:14:02 am »
I am using the OpenGL lighting system in SFML.
I am aware that SFML is 2D, but must have a z-value.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: What is the default z-value on SFML?
« Reply #3 on: July 05, 2012, 09:44:02 am »
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.
Laurent Gomila - SFML developer

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: What is the default z-value on SFML?
« Reply #4 on: July 05, 2012, 04:25:29 pm »
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.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).