python and glut

M

max(01)*

hi there.

i installed python2.3-opengl, then i tried one of those demos:

----

#!/usr/bin/python2.3

# This is statement is required by the build system to query build info
if __name__ == '__build__':
raise Exception

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


class GLE_demo:

def __init__(self):
# initial mouse position
self.lastx = 121
self.lasty = 121

# set the display mode and create the window
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH)
glutCreateWindow("GLE demo")

# setup the callbacks
glutDisplayFunc(self.on_display)
glutMotionFunc(self.on_motion)
glutReshapeFunc(self.on_reshape)

#
glClearDepth(1.0)
glEnable(GL_DEPTH_TEST)
glClearColor(0.0, 0.0, 0.0, 0.0)
glShadeModel(GL_SMOOTH)

glMatrixMode(GL_MODELVIEW)
# initialize lighting */
glLightfv(GL_LIGHT0, GL_POSITION, (40.0, 40, 100.0, 0.0))
glLightfv(GL_LIGHT0, GL_DIFFUSE, (0.99, 0.99, 0.99, 1.0))
glEnable(GL_LIGHT0)
glLightfv(GL_LIGHT1, GL_POSITION, (-40.0, 40, 100.0, 0.0))
glLightfv(GL_LIGHT1, GL_DIFFUSE, (0.99, 0.99, 0.99, 1.0))
glEnable(GL_LIGHT1)
glEnable(GL_LIGHTING)
glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE)
glEnable(GL_COLOR_MATERIAL)


def on_motion(self, x, y):
# store the mouse coordinate
self.lastx = x
self.lasty = y
# redisplay
glutPostRedisplay()


def on_reshape(self, width, height):
# setup the viewport
glViewport(0, 0, width, height)
# setup the projection matrix
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
# calculate left/right and top/bottom clipping planes
based the
smallest square viewport
a = 9.0/min(width, height)
clipping_planes = (a*width, a*height)
# setup the projection
glFrustum(-clipping_planes[0], clipping_planes[0],
-clipping_pla
nes[1], clipping_planes[1], 50.0, 150.0)


def on_display(self):
# clear the buffer
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)

# Set up the model view matrix
glMatrixMode(GL_MODELVIEW)
glLoadIdentity()
glTranslatef(0.0, 0.0, -80.0)
glRotatef(self.lastx, 0.0, 1.0, 0.0)
glRotatef(self.lasty, 1.0, 0.0, 0.0)

# a nice pale lime green
glColor3f(0.6, 0.8, 0.3)

# set the join styles for GLE
gleSetJoinStyle(TUBE_NORM_EDGE | TUBE_JN_ANGLE |
TUBE_JN_CAP)
gleHelicoid(1.0, 6.0, 2.0, -3.0, 4.0, None, None, 0.0,
1080.0)

# swap the buffer
glutSwapBuffers()



if __name__ == '__main__':
# initialize GLUT
glutInit(sys.argv)
# create the demo window
GLE_demo()
# enter the event loop
glutMainLoop ()

----

(sorry for some line breaks, some day i'll repair my newsreader)

but when i try to run it:

$ python GLE.py
freeglut (GLE.py): OpenGL GLX extension not supported by display ':0.0'

what's up? what's missing?

i use a standard debian installation.

thanks for your attention

bye

max
 
M

Mike Meyer

max(01)* said:
$ python GLE.py
freeglut (GLE.py): OpenGL GLX extension not supported by display ':0.0'

what's up? what's missing?

The GLX extension to your X server.
i use a standard debian installation.

I don't know which X debian uses, and it may have changed over time,
so you'll want to specify the name of the distribution. You'd be
better off asking in a support group for the X distribution you're
using.

<mike
 
L

Lonnie Princehouse

See if you can run `glxgears`, and read the output of `glxinfo`. If
neither of those work, you will probably have better luck on a debian
or XFree86/xorg forum than on c.l.py
 
M

max(01)*

Mike said:
The GLX extension to your X server.




I don't know which X debian uses, and it may have changed over time,

mine uses XFree86, Version 4.3.0.1 (from the man page)
so you'll want to specify the name of the distribution.

woody.

thanks

max
 
M

max(01)*

Lonnie said:
See if you can run `glxgears`, and read the output of `glxinfo`.

$ glxgears
Xlib: extension "GLX" missing on display ":0.0".
Error: couldn't get an RGB, Double-buffered visual
$ glxinfo
name of display: :0.0
Xlib: extension "GLX" missing on display ":0.0".
Xlib: extension "GLX" missing on display ":0.0".
Xlib: extension "GLX" missing on display ":0.0".
Error: couldn't find RGB GLX visual

visual x bf lv rg d st colorbuffer ax dp st accumbuffer ms cav
id dep cl sp sz l ci b ro r g b a bf th cl r g b a ns b eat
----------------------------------------------------------------------
Xlib: extension "GLX" missing on display ":0.0".
Xlib: extension "GLX" missing on display ":0.0".
0x21 16 tc 1 0 0 c . . 0 0 0 0 0 0 0 0 0 0 0 0 0 None

----

now what?

bye

max
 
M

max(01)*

Lonnie said:
See if you can run `glxgears`, and read the output of `glxinfo`. If
neither of those work, you will probably have better luck on a debian
or XFree86/xorg forum than on c.l.py

your hints were helpful anyway. thanks!

ok, i uncommented the line:

Load "glx"

in my /etc/X11/XF86Config file.

now glxgears seems to work...

except for the following message:

Xlib: extension "XFree86-DRI" missing on display ":0.0".

can you give some more help? (sorry again for being offtopic)

max
 
L

Lonnie Princehouse

Welcome to the exciting world of trying to make graphics work on Linux
=)

DRI is direct rendering. The Module section of your XF8Config should
have:

Load "glx"
Load "dri"
Load "GLCore"

That probably won't solve things.
Google for some combination of ("debian" + "xfree86" + your video
card), and also Google the error messages you get (e.g. "XFree86-DRI
missing on display" )

DRI not working could also be a permissions issue; check to see if it
works as root.

Once your XFree86 is set up properly, the Python OpenGL bindings should
work just fine.
 
M

max(01)*

Lonnie said:
DRI not working could also be a permissions issue; check to see if it
works as root.

that's it! :)

now, how can i make it work as "joe user"?

bye

max
 
M

max(01)*

Lonnie said:
Welcome to the exciting world of trying to make graphics work on Linux
=)

DRI is direct rendering. [...]
DRI not working could also be a permissions issue; check to see if it
works as root.

that's it! :)

now, how can i make it work as "joe user"?

bye

max
 
M

Marc 'BlackJack' Rintsch

that's it! :)

now, how can i make it work as "joe user"?

I have this in my XF86Config and I'm in the `video` group::

Section "DRI"
Group "video"
Mode 0660
EndSection

Ciao,
Marc 'BlackJack' Rintsch
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top