Exemplo n.º 1
0
        public void GetScreenCoord(double wX, double wY, double wZ,
                                   ref double scrX, ref double scrY, ref double scrZ)
        {
            unsafe
            {
                fixed(double *m_dModelViewMatrixPtr = m_dModelViewMatrix)
                {
                    fixed(double *m_dProjectionMatrixPtr = m_dProjectionMatrix)
                    {
                        fixed(int *m_iViewportPtr = m_iViewport)
                        {
                            double scrXVal = scrX;
                            double scrYVal = scrY;
                            double scrZVal = scrZ;

                            OpenGLControl.gluProject(wX, wY, wZ,
                                                     m_dModelViewMatrixPtr, m_dProjectionMatrixPtr, m_iViewportPtr,
                                                     &scrXVal, &scrYVal, &scrZVal);
                            scrX = scrXVal;
                            scrY = scrYVal;
                            scrZ = scrZVal;
                        }
                    }
                }
            }
            scrY  = m_iViewport[3] - scrY;
            scrZ += GetFocalLength();
        }