开发者

How to draw a 3D donut chart in OpenGL?

开发者 https://www.devze.com 2022-12-26 10:42 出处:网络
I would like to draw a chart in OpenGL similar to the do开发者_如何学JAVAnut graph at the bottom-right of this example.

I would like to draw a chart in OpenGL similar to the do开发者_如何学JAVAnut 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.

How to draw a 3D donut chart in OpenGL?

(source: ofmichaelanderson.com)


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.


Are there any specific reasons why you want to use OpenGL to draw these charts?

I've been hearing pretty good things about JFreechart.

0

精彩评论

暂无评论...
验证码 换一张
取 消