X/Y/Z?

Started by
3 comments, last by Matei 19 years, 8 months ago
Hi, i have read lots of code and tutorials and i still don't get this: I have read opengl's default view is from top to bottom (along the z axis), i have read code that assumes Y is height and X/Z is the ground plane, i also have read a lot of code that uses Z as the height axis and X/Y as the ground plane. What is the 'official' height axis? Is there any? What is the most used? I always use Z as height, simply because the ground plane is most used when doing 2d stuff (like a map and quadtrees) and X/Y simply works better than X/Z, it just feels more logical to me.
Advertisement
Just use whichever you prefer. I personally use Y as height, but there is no rule saying it must be done that way. I OGL and DX, y is usually height by default, but it can easily be changed (in DX at least).

As long as no one else is working with your code, you can use any axis you want. If you are working on a team or are using it for a demonstration/tutorial, it would probably be best to us the norm, or at least explain what you did very well.
Sean Henley [C++ Tutor]Rensselaer Polytechnic Institute
The way I see it:
In rendering, Y is height, as you are drawing on a screen where Z is the depth. In mapping (and keeping track of player postions in a 3d world etc) X and Y are your co-ordinates, and Z is height.

I personnally use Z for height, but you could use C V and [ if it makes you feel happy.
working with OpenGL, the default axis orientation (no glRotate yet) is:

x axis is positive to the right of the screen,
y axis is positive up, and
z axis is positive coming out of the screen toward the user.

so I use y for height
I use the convention I see in my modeller (Blender), which is XY for the ground plane and Z for height, so I don't have to do anything special when importing meshes.

This topic is closed to new replies.

Advertisement