原点

origin.png

座標軸を描くコード

    static void DrawCoordinate(float _length){//座標軸を描く
        glColor3f(1.0,0.0,0.0);    
        glLineWidth(3);
        glRasterPos3f(_length,0.0,0.0);
        glutBitmapString(GLUT_BITMAP_HELVETICA_18,(const unsigned char*)("x"));
        glColor3ub(255,170,0);
        glRasterPos3f(0.0,_length,0.0);
        glutBitmapString(GLUT_BITMAP_HELVETICA_18,(const unsigned char*)("y"));
        glColor3f(0.0,0.0,1.0);
        glRasterPos3f(0.0,0.0,_length);
        glutBitmapString(GLUT_BITMAP_HELVETICA_18,(const unsigned char*)("z"));
        glBegin(GL_LINES);
        glColor3f(1.0,0.0,0.0);
        glVertex3f(0.0,0.0,0.0);
        glVertex3f(_length,0.0,0.0);
 
        glColor3ub(255,170,0);//y is yellow
        glVertex3f(0.0,0.0,0.0);
        glVertex3f(0.0,_length,0.0);
 
        glColor3f(0.0,0.0,1.0);
        glVertex3f(0.0,0.0,0.0);
        glVertex3f(0.0,0.0,_length);
        glEnd();
    }

サポートサイト Wikidot.com