Jump to content
  • Advertisement
Sign in to follow this  
Tree Penguin

OpenGL X/Y/Z?

This topic is 5229 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!