小编Gol*_*aji的帖子

在visual studio 2010和c ++中使用OpenGL绘制轴箭头

使用openGL,我可以在屏幕中心绘制轴(x,y和z),但我无法在每行的末尾绘制箭头.在2d我看到一个使用GL_LINE_STRIP的示例代码,但在3D中,我用googled很多,我没有找到任何例子; 现在我只是在每一行的末尾添加一个点; 但实际上它非常难看.

我怎么画它?这段代码只是将z轴的圆柱体画到适当的位置; 我怎样才能设定其他人?

void Axis_3D (void)
{
    GLUquadric* cyl = gluNewQuadric();
    GLUquadric* cy2 = gluNewQuadric();
    GLUquadric* cy3 = gluNewQuadric();

   // gluCylinder (cyl, 0.02, 0.02, 4, 16, 1);        // Body of axis.

    glColor3f (1,1,1);                                // Make arrow head white.
    glPushMatrix ();
       glTranslatef (0.0,0.0,4);
       gluCylinder(cyl, 0.04, 0.000, 0.1, 12,1);   // Cone at end of axis.

       glTranslatef (0.0,4,0.0);
       gluCylinder  (cy2, 0.04, 0.001, 0.1, 12,1);

       glTranslatef (4,0.0,0.0);
       gluCylinder  (cy3, 0.04, 0.001, 0.1, 12,1);
    glPopMatrix ();
}
Run Code Online (Sandbox Code Playgroud)

非常感谢!

c++ opengl visual-studio-2010

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

c++ ×1

opengl ×1

visual-studio-2010 ×1