[英]how to use gl_polygon to draw 3d cylinder
i am new opengl learner. 我是新的opengl学习者。 i know there is build in function to draw cylinder in glut something like
我知道有内置功能可以将圆筒中的油脂过剩
GLUquadricObj *quadratic;
quadratic=gluNewQuadric();
gluCylinder(quadratic,0.6f,0.6f,1.5f,20,20);
However, is there any other way to draw cylinder using glBegin(GL_POLYGON) and glvertex3d, i am not quite clear about the algorithm behind, please help. 但是,还有其他使用glBegin(GL_POLYGON)和glvertex3d绘制圆柱体的方法,我对后面的算法不太清楚,请帮忙。
Use sin/cos to trace around a circle in segments. 使用sin / cos在段中围绕一个圆圈跟踪。 Extend those segments upwards with 2 triangles.
用2个三角形向上扩展这些段。 Then connect them to close the ends.
然后连接它们以封闭端部。
You may be able to find the source online for freeglut. 您可能可以在线找到freeglut的来源。 Here's some Java code I found: http://massapi.com/source/lwjgl-source-2.7.1/src/java/org/lwjgl/util/glu/Cylinder.java.html
这是我发现的一些Java代码: http : //massapi.com/source/lwjgl-source-2.7.1/src/java/org/lwjgl/util/glu/Cylinder.java.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.