I'm new to OpenGL. It appears that I can make whatever axis be "up" that I want. However, what is idiomatic/conventional?
+2
A:
I like +Z to be "up". Makes it easier for me to reason about glVertex()
, glNormal()
, and glTexCoord()
calls.
That said the default/identity GL_MODELVIEW
matrix has +Y being "up".
genpfault
2010-09-20 21:40:24
Me too, particularly when doing "outdoor" stuff like terrains (+X = East, +Y = North, +Z = Up).
Incredulous Monk
2010-09-21 05:32:11
Me too. It also easier for me to implement first-person camera rotation like this. Another argument is that in mathematics you commonly write z = f(x,y), which is connected to the terrain argument.
ybungalobill
2010-09-21 22:01:57
+2
A:
Generally
- X is horizontal
- Y is up
- Z is depth (hence Z-buffer)
you can largely adopt any convention you wish as long as you are internally consistent, but the above is pretty much the standard and using it yourself will make other code easier to understand.
Cruachan
2010-09-20 21:48:06