my openGL API need threads!!! But how to ,ake it work???

Laurent l.exsteens at gmail.com
Thu Feb 2 07:39:32 EST 2006


Hi,

here is the context:

I'm coding a openGL API I will need for a project for my school.
This API is quite simple:

an ooglScene describe all needed to make an openGL, and inherits from a
list. So an ooglScene is fundamentaly a list of ooglObjects (which is
organised as a Composite Pattern).

ooglScene.run() do everthing needed to initialise GL and GLUT, and then
launch the GLUT Main Loop.
(the display function I wrote juste call the display method of each
ooglObject in the ooglScene)

Here is the problem!

Once the GLUT Main Loop is launched, I cannot add other ooglObjects to
my ooglScene, neither modify any existing ooglObject in my scene!

exemple that works but is sequential:
------------------------------------------------------
Scene = ooglScene()
Scene.append(ooglObject())
Scene.run()

What I want to do:
---------------------------
Scene = ooglScene()
Scene.run()
Scene.append(ooglObject())



I don't know the threqding system, I've take a look on that but I don't
know how to make what I need: the ooglScene.run() method must create a
separate thread to launch the glutMainLoop!

Actually I see only one solution: create two threads out of the
ooglScene and launch run() in one, and the rest of my program in the
other:

Thread1.start() --> launch the ooglScene.run()
Thread2.start() --> launch the rest of my program...

THIS IS NOT ENOUGH TRANSPARENT IN MY POINT OF VIEW!!




More information about the Python-list mailing list