[PyOpenGL-Users] Creating a postscript image of a scene : how do I use openglutil ?
Brought to you by:
mcfletch
|
From: Champ H. <cha...@be...> - 2003-05-19 12:43:03
|
Hello,
I need to create PostScript image of a scene created with PyOpenGL. I
have seen that "openglutil" should provide the required
functionnalities such as "openglutil.glSaveEPS('teapot.eps', 240,
240)". However my installation does not seem to recognize "openglutil"
and I get the error message : "NameError: global name 'openglutil' is
not defined" when I run the following program (lising #3 of article
http://www.linuxjournal.com/article.php?sid=4830):
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.Tk import *
import sys
def display(togl):
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
glColor3f(0.3, 1.0, 1.0)
glMaterialfv(GL_FRONT, GL_AMBIENT,
[0.1745, 0.0, 0.1, 0.0])
glMaterialfv(GL_FRONT, GL_DIFFUSE,
[0.1, 0.0, 0.6, 0.0])
glMaterialfv(GL_FRONT, GL_SPECULAR,
[0.7, 0.6, 0.8, 0.0])
glMaterialf(GL_FRONT, GL_SHININESS, 80)
glutSolidTeapot(1.0)
glFlush()
openglutil.glSaveEPS('teapot.eps', 240, 240)
sys.exit()
togl = Opengl(width = 250, height = 250, double = 1)
togl.redraw = display
togl.pack(side = 'top', expand = 1, fill = 'both')
togl.basic_lighting()
togl.set_background(0, 0, 0)
togl.mainloop()
Here is my system configuration:
- windows XP professional
- python 2.2.2
- PyOpenGL 2.0.0.44
What do I need to install openglutil ? How to do it ? Is there other
way of creating images (jpeg, bmp, png, gif ...) from PyOpenGL scenes ?
Thanks,
Bernard
|