0

PyOpenGL (PyODE と一緒に) を使用してソリッド シリンダーを描画しようとしていますが、次のエラーが発生します。

OpenGL.error.NullFunctionError: Attempt to call an undefined function glutSolidCylinder, check for bool(glutSolidCylinder) before calling

私は次の 3 つのインポートを持っており、他の glut* 呼び出し (glutSolidSphere、glutSolidCube など) を問題なく使用していますが、これは問題を引き起こします。

from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
...
glutSolidCylinder(RADIUS, LENGTH, SLICES, STACKS)

私は Python 2.7 を使用してprint(bool(glutSolidCylinder))います。テストすると、 False.

PyOpenGL のインストールにも Pip を使用しました。

4

1 に答える 1

1

元の GLUT 実装にはシリンダー関数がありませんが、freeglut にはあります ( source ) (そして、Python 2.7.1、PyOpenGL 3.0.1 と FreeGLUT 2.6.0 を一緒に使用すると、Ubuntu 12.04 でうまく動作します)。

ただし、Python では、GLU 関数を使用してシリンダーを作成することもできます。

quadratic = gluNewQuadric()
gluCylinder(quadratic, BASE, TOP, HEIGHT, SLICES, STACKS)      # to draw the lateral parts of the cylinder;
gluDisk(quadratic, INNER_RADIUS, OUTER_RADIUS, SLICES, LOOPS)  # call this two times in the appropriate environment to draw the top and bottom part of the cylinder with INNER_RADIUS=0.
于 2013-09-10T21:44:45.817 に答える