Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > About PyOpenGL

Reply
Thread Tools

About PyOpenGL

 
 
truelixin@gmail.com
Guest
Posts: n/a
 
      01-05-2009
I follow the <OpenGL Programming Guide>, write a small test:

#!/usr/bin/env python
# encoding=utf-8

import sys
from OpenGL.GL import *
from OpenGL.GLUT import *

def display():
glClear(GL_COLOR_BUFFER_BIT)
glColor(1.0, 1.0, 1.0)
glBegin(GL_POLYGON)
glVertex(0.25, 0.25, 0.0)
glVertex(0.75, 0.25, 0.0)
glVertex(0.75, 0.75, 0.0)
glVertex(0.25, 0.75, 0.0)
glEnd()
glFlush()

def init():
glClearColor(0.0, 0.0, 0.0, 0.0)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0)

def main():
glutInit(sys.argv)
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB)
glutInitWindowSize(250, 250)
glutInitWindowPosition(100, 100)
glutCreateWindow('hello')
init()
glutDisplayFunc(display)
glutMainLoop()

if __name__ == '__main__':
main()

But I got an error:

Traceback (most recent call last):
File "test.py", line 36, in <module>
main()
File "test.py", line 26, in main
glutInit(sys.argv)
File "c:\python25\lib\site-packages\PyOpenGL-3.0.0b8-py2.5-win32.egg
\OpenGL\GLUT\special.py", line 316, in glutInit
_base_glutInit( ctypes.byref(count), holder )
File "c:\python25\lib\site-packages\PyOpenGL-3.0.0b8-py2.5-win32.egg
\OpenGL\GLUT\special.py", line 57, in _base_glutInit
return __glutInitWithExit(pargc, argv, _exitfunc)
File "c:\python25\lib\site-packages\PyOpenGL-3.0.0b8-py2.5-win32.egg
\OpenGL\platform\baseplatform.py", line 280, in __call__
self.__name__, self.__name__,
OpenGL.error.NullFunctionError: Attempt to call an undefined function
__glutInitWithExit, check for bool(__glutInitWithExit) before calling

Can anyone please tell me why?
 
Reply With Quote
 
 
 
 
Cousin Stanley
Guest
Posts: n/a
 
      01-05-2009

> ....
> OpenGL.error.NullFunctionError: Attempt to call an undefined function
> __glutInitWithExit, check for bool(__glutInitWithExit) before calling
>
> Can anyone please tell me why?


Your opengl program runs exactly as coded without error
under Debian 5.0 Linux Lenny ....

Perhaps a required library is missing
from your opengl installation ....

Sorry I couldn't provide more help ....


--
Stanley C. Kitching
Human Being
Phoenix, Arizona

 
Reply With Quote
 
 
 
 
truelixin@gmail.com
Guest
Posts: n/a
 
      01-06-2009
On Jan 6, 12:58*am, Rob Williscroft <(E-Mail Removed)> wrote:
> (E-Mail Removed) wrote in news:f8099226-a953-4598-bfe2-61ee5772ce26
> @l33g2000pri.googlegroups.com in comp.lang.python:
>
>
>
>
>
> > Traceback (most recent call last):
> > * File "test.py", line 36, in <module>
> > * * main()
> > * File "test.py", line 26, in main
> > * * glutInit(sys.argv)
> > * File "c:\python25\lib\site-packages\PyOpenGL-3.0.0b8-py2.5-win32.egg
> > \OpenGL\GLUT\special.py", line 316, in glutInit
> > * * _base_glutInit( ctypes.byref(count), holder )
> > * File "c:\python25\lib\site-packages\PyOpenGL-3.0.0b8-py2.5-win32.egg
> > \OpenGL\GLUT\special.py", line 57, in _base_glutInit
> > * * return __glutInitWithExit(pargc, argv, _exitfunc)
> > * File "c:\python25\lib\site-packages\PyOpenGL-3.0.0b8-py2.5-win32.egg
> > \OpenGL\platform\baseplatform.py", line 280, in __call__
> > * * self.__name__, self.__name__,
> > OpenGL.error.NullFunctionError: Attempt to call an undefined function
> > __glutInitWithExit, check for bool(__glutInitWithExit) before calling

>
> To get you code running I needed (in addition to the PyOpenGL download)
> to download.
>
> glut-3.7.6-bin.zip (117 KB) fromhttp://www.xmission.com/~nate/glut.html
>
> and put the glut32.dll where python can find it, the readme says
> <windows>\system which worked, but sticking it in the same directory
> as python.exe (c:\python25 in your case) worked too.
>
> http://pyopengl.sourceforge.net/http...tallation.html
>
> Rob.
> --http://www.victim-prime.dsl.pipex.com/


Yeah! It works now!
Thank you very much!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PyOpenGL demo in wxPython demo crashes F. GEIGER Python 9 05-03-2004 04:43 PM
Installing PyOpenGL - can't find libnumarray module Steven Gutstein Python 3 12-30-2003 06:08 AM
pyOpenGL for python 2.3 Jimmy Johns Python 3 11-18-2003 05:45 AM
re: pyopengl / python2.3 / win32 Arthur Python 1 10-06-2003 07:52 PM
pyopengl / python2.3 / win32 John Hunter Python 0 09-22-2003 08:35 PM



Advertisments