如何在OpenGL中绘制3D圆环图?
我想在 OpenGL 中绘制一个类似于本示例右下角的圆环图的图表。
我有绘制 2D 图表(例如示例中的主图表)的经验,但令我困惑的是我想要绘制的图表是绘制 3D 图表时使用的正确图元类型。我考虑过使用 GL_QUAD_STRIP 和 GL_POLYGON 但似乎都不适合该任务。我应该从哪里开始?
我将使用 JOGL 和 Java 来绘制图表,如果这有帮助的话。另外,我不一定需要挤出图表的某些切片,如示例中所示。
更新:即使有更简单的替代方案,我确实需要使用 OpenGL 进行绘图。这是我对需要 OpenGL 渲染的作业的研究的一部分。
I would like to draw a chart in OpenGL similar to the donut graph at the bottom-right of this example.
I have experience with drawing 2D charts such as the main chart in the example but what confuses me about the one I want to draw is the correct type of primitive to use when drawing the 3D chart. I have considered using GL_QUAD_STRIP and GL_POLYGON but neither seem quite right for the task. Where should I begin?
I will be using JOGL with Java to draw the chart, if that helps at all. Also, I don't necessarily need to extrude certain slices of the chart as shown in the example.
Update: I do need to use OpenGL for drawing even if there are easier alteratives. This is part of my research for an assignment that requires OpenGL rendering.
(source: ofmichaelanderson.com)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只需使用 GL_TRIANGLE_STRIP,甜甜圈(或圆环)的每段就会有四个条带:顶部、底部、外部和内部。如果您决定支持挤压,当然也需要每个部分的“端盖”。
您可能可以通过搜索环面渲染找到教程。
Just use GL_TRIANGLE_STRIP, there will be four strips per segment of the donut (or torus): top, bottom, outer and inner. If you decide to support extrusion, you will of course need "endcaps" for each segment, too.
You can probably find tutorials by searching for torus rendering.
您想使用 OpenGL 绘制这些图表有什么具体原因吗?
我听说过有关 JFreechart 的好消息。
Are there any specific reasons why you want to use OpenGL to draw these charts?
I've been hearing pretty good things about JFreechart.