i want to make an 3d axis to draw an cylinder which can move it s for my final exam
anyone can help me
Originally posted by genjik:
i want to make an 3d axis to draw an cylinder which can move it s for my final exam
anyone can help me
One 3D axis coming up:
static void util_drawAxis( int length )
{
float width;
glGetFloatv( GL_LINE_WIDTH, &width );
glPushAttrib( GL_ENABLE_BIT );
glEnable( GL_LINE_SMOOTH );
glPushMatrix();
glLineWidth( 1 );
/* x axis */
glColor4f( 0, 0, 1, 1 );
glBegin( GL_LINES );
glVertex3f( -10, 0, 0 );
glVertex3f( (float)length, 0, 0 );
glEnd();
/* y axis */
glColor4f( 1, 0, 0, 1 );
glBegin( GL_LINES );
glVertex3f( 0, -10, 0 );
glVertex3f( 0, (float)length, 0 );
glEnd();
/* z axis */
glColor4f( 1, 1, 0, 1 );
glBegin( GL_LINES );
glVertex3f( 0, 0, -10 );
glVertex3f( 0, 0, (float)length );
glEnd();
glLineWidth( width );
glPopMatrix();
glPopAttrib();
}