newsb

04-21-2012, 08:46 PM

Hi

def arrow(x,y,z):

glMatrixMode(GL_MODELVIEW)

glPushMatrix()

#glLoadIdentity()

glLineWidth(3)

glColor3f(1.0, 1.0, 1.0)

L = sqrt(x**2+y**2+z**2)

glBegin(GL_LINES)

glVertex3f(0.0, 0.0, 0.0)

glVertex3f( float(x), float(y), float(z))

glEnd()

arrcyl = gluNewQuadric()

# gluCylinder: quadr., base, top, hgt, slices, stack

gluCylinder(arrcyl, 0., 0.3, 1.0, 6, 6)

glPopMatrix()

This code is incorrect, because I need to rotate the gluCylinder correctly. Unfortunately, I don't know exactly what is the best way to do this (currently, gluCylinder just points in the z-direction, independent of the GL_LINES-piece)...

Also, why doesn't it work with glLoadIdentity() ???

def arrow(x,y,z):

glMatrixMode(GL_MODELVIEW)

glPushMatrix()

#glLoadIdentity()

glLineWidth(3)

glColor3f(1.0, 1.0, 1.0)

L = sqrt(x**2+y**2+z**2)

glBegin(GL_LINES)

glVertex3f(0.0, 0.0, 0.0)

glVertex3f( float(x), float(y), float(z))

glEnd()

arrcyl = gluNewQuadric()

# gluCylinder: quadr., base, top, hgt, slices, stack

gluCylinder(arrcyl, 0., 0.3, 1.0, 6, 6)

glPopMatrix()

This code is incorrect, because I need to rotate the gluCylinder correctly. Unfortunately, I don't know exactly what is the best way to do this (currently, gluCylinder just points in the z-direction, independent of the GL_LINES-piece)...

Also, why doesn't it work with glLoadIdentity() ???