[Tutor] pyopengl name error
Rick Pasotto
rick@niof.net
Tue, 10 Apr 2001 09:13:41 -0400
On Mon, Apr 09, 2001 at 05:11:26PM -0600, VanL wrote:
> Hello,
>
> If this is too pyopengl-specific, I'll take this question there.
> However, it seems to actually be a problem with namespaces, so I decided
> to try this group first.
>
> I installed pyOpenGL. I can import it, get a listing of available
> functions from dir(), etc. However, When I try to run the example code
> drawcube.py, I get the following error:
>
> Traceback (most recent call last):
> File "glut.py", line 69, in OnDraw
> drawCube()
> File "drawcube.py", line 3, in drawCube
> OpenGL.GL.glTranslatef(0.0, 0.0, -2.0);
> NameError: There is no variable named 'OpenGL'
> Traceback (most recent call last):
> File "glut.py", line 69, in OnDraw
> drawCube()
> File "drawcube.py", line 3, in drawCube
> OpenGL.GL.glTranslatef(0.0, 0.0, -2.0);
> NameError: There is no variable named 'OpenGL'
> Traceback (most recent call last):
> File "glut.py", line 69, in OnDraw
> drawCube()
> File "drawcube.py", line 3, in drawCube
> OpenGL.GL.glTranslatef(0.0, 0.0, -2.0);
> NameError: There is no variable named 'OpenGL'
>
>
> Here is the code throwing the exception:
>
>
> '''GLUT rendering context sample
> '''
> from OpenGL.GL import *
> from OpenGL.GLUT import *
You haven't imported OpenGL. Instead you have imported some of the
*contents* of OpenGL. Change your line to
glTranslatef(0.0, 0.0, -2.0)
and I suspect it will work.
--
"Being an elected Libertarian is like being a designated driver in a bar."
--- Michael Emerling Cloud
Rick Pasotto email: rickp@telocity.com