Questions tagged «opentk»

3
如何实现基于四元数的相机?
更新这里的错误是一个非常简单的错误。我错过了弧度到度的转换。如果您还有其他问题,则无需阅读全文。 我看了几本关于此的教程,当我以为自己理解时,便尝试实现基于四元数的相机。问题是,旋转大约10分钟后,它无法正常工作。10度会跳回-10度。我不知道怎么了 我正在使用openTK,它已经有一个四元数类。我是opengl的菜鸟,我只是出于娱乐目的而做,并不真正了解四元数,所以我可能在这里做一些愚蠢的事情。这是一些代码:(实际上,除了加载和绘制vbo的方法外,几乎所有代码(它取自于演示vbo-s的OpenTK示例)) 我将多维数据集加载到vbo中并初始化相机的四元数 protected override void OnLoad(EventArgs e) { base.OnLoad(e); cameraPos = new Vector3(0, 0, 7); cameraRot = Quaternion.FromAxisAngle(new Vector3(0,0,-1), 0); GL.ClearColor(System.Drawing.Color.MidnightBlue); GL.Enable(EnableCap.DepthTest); vbo = LoadVBO(CubeVertices, CubeElements); } 我在这里加载透视投影。每次我调整窗口大小时,它都会在开始时加载。 protected override void OnResize(EventArgs e) { base.OnResize(e); GL.Viewport(0, 0, Width, Height); float aspect_ratio = Width / (float)Height; Matrix4 perpective = …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.