Home

  
Home Cavernosa
PyGLUT Blender
Links   
My Site
Intro
Cavernosa
PyGLUT
Blender
Links
 
PyGLUT
Download
 
Email me
mailto
 
 

  

PyGLUT

PyGLUT makes GLUT available from the Python interpreter. It exposes everything from GLUT 3.7 including the API version 4 stuff related to games. That includes full-screen modes, joystick input, and non-repeating key-up and key-down reporting.

A Python code block using it looks the same as the equivalent C/C++. Where you would pass GLUT a C callback function, you can pass a callable PyObject to PyGLUT. Most simply, that would be a normal Python function, but it could be a wrapped function of another compiled extension or anything else that is callable.

def display():
    # Call some extension that renders using OpenGL.
    # ...
    glutPostRedisplay()

def mouse(button, state, x, y):
    if state == GLUT_UP: ...
    if state == GLUT_DOWN: ...

def motion(x, y):
    ...
def keyboard(key, x, y):
    ...

glutInit(1, ['poop'])
glutInitDisplayMode(0) # RGBA
win_id = glutCreateWindow('PyGLUT')
glutDisplayFunc(display)
glutMotionFunc(motion)
glutKeyboardFunc(keyboard)
glutMouseFunc(mouse)
glutMainLoop()

In the zip you will find the source code and a compiled Win32 dll Python extension. Also in the zip are a custom build of the Python 1.5.2 interpreter, a custom built Glut32.dll, the Python shell exe and two simple demo scripts.

To run the demos simply drag PyGLUT.py or PyGLUTMenu.py onto the Python.exe provided.

Download.

Copyright � 2000-2001 Andrew H. Cox. All rights reserved.
[email protected]


FastCounter by LinkExchange