I'm using OpenGL with gluPerspective, what would I need to do to make it use an axis-system which the origin is top left instead of bottom left?
相关问题
- Is GLFW designed to use without LWJGL (in java)?
- glDrawElements only draws half a quad
- Direct2D Only Partially Linking in C++ Builder
- Scaling png font down
- OpenGL buffer update [duplicate]
相关文章
- Converting glm::lookat matrix to quaternion and ba
- Algorithm for partially filling a polygonal mesh
- Robust polygon normal calculation
- Behavior of uniforms after glUseProgram() and spee
- Keep constant number of visible circles in 3D anim
- GLEW and Qt5 redefinition of headers
- How do I remove axis from a rotation matrix?
- How to smooth the blocks of a 3D voxel world?
I would say direct operating on the projection matrix is a clean way for this operation. But if by any chance you need an alternative:
You can just use
glScalef(1.f, -1.f, 1.f)
to flip the axis.This is also just an operation on the GL_MODELVIEW or GL_PROJECTION matrix (whatever is currently active).
You can do this by flipping the
y
-axis of the projection matrix. So:That ought to do it.
You could also use a
glMultMatrix
call with the same matrix (instead ofPush
and thenLoad
), but this way is more easily reversed (just callglPopMatrix
on theGL_PROJECTION
stack later).You can also use the same technique to flip any of the other axes; just put minus signs in the appropriate locations.