I'm using a Lua API. I'm trying to transform 3D space coordinates to 2D space coordinates. I've asked google but I can't find anything apart from snippets using OpenGL function. I don't need source code or anything just a simple way on how to do it? I can acquire the Camera's perspective, the original position to be transformed, window size and aspect ratio if that's any help? Thanks in advance for any suggestions :)
相关问题
- Is GLFW designed to use without LWJGL (in java)?
- Set *both* elements and initial capacity of std::v
- How to determine +/- sign when calculating diagona
- How does gl_ClipVertex work relative to gl_ClipDis
- Is it more efficient to set the size of a vector u
相关文章
- Algorithm for partially filling a polygonal mesh
- How do I get characters common to two vectors in C
- Robust polygon normal calculation
- Keep constant number of visible circles in 3D anim
- How can I unpack (destructure) elements from a vec
- Can i use Calc inside Transform:Scale function in
- How do I remove axis from a rotation matrix?
- How to smooth the blocks of a 3D voxel world?
If you're talking about transforming world-space (x,y,z) coordinates to screen-space (u,v) coordinates, then the basic approach is:
If the camera is not at the origin, transform (x,y,z) by the view matrix before the projection matrix. You may also want to adjust for the camera perspective, aspect ratio etc., in which case I'd refer to this Wikipedia article.
My apologies if you're looking for something specific to the Lua API, which I am not familiar with.