在OpenGL中创建直角三棱柱
我正在学习 OpenGL(具体来说,使用 JOGL)并且我正在尝试创建一个直角三棱柱。我了解到您可以使用 glutWire/SolidCylinder 和少量切片(显然,三角形为 3 个)创建一个等边棱柱。
所以我想知道是否有其他方法可以制作棱镜,或者是否有某种方法可以缩放等边三角形以将其变成直角三角形?
I'm learning OpenGL (specifically, using JOGL) and I'm trying to create a right-angled triangular prism. I learned you can create an equilateral prism with glutWire
/SolidCylinder
and a a low number of slices (3 for a triangle, obviously).
So I'm wondering if there's some other way to make a prism, or if there's some way to scale an equilateral triangle to turn it into a right triangle?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我还发现(至少在 JOGL 中,不知道其他地方) glutSolidCylinder 无法正常工作 - 端板以与侧面不同的旋转方式绘制,给你一个非常奇怪的形状。
所以我最终只是提出了一种方法来创建一个单位直角三棱柱,然后您可以根据需要旋转和缩放它。可能有更好的方法可以做到这一点,因此欢迎发表评论:
I additionally found that (at least in JOGL, no idea about elsewhere) glutSolidCylinder doesn't work correctly - the endplates are drawn at a different rotation than the sides, giving you a very strange looking shape.
So I ended up just making a method that creates a unit-right-triangular prism which you can then rotate and scale as necessary. There's likely much better ways to do this, so comments are welcome: