Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r1030 - trunk/SwigInterface


Chronological Thread 
  • From: bigler@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r1030 - trunk/SwigInterface
  • Date: Mon, 1 May 2006 12:53:37 -0600 (MDT)

Author: bigler
Date: Mon May  1 12:53:37 2006
New Revision: 1030

Modified:
   trunk/SwigInterface/manta.i
   trunk/SwigInterface/wxManta.py
Log:

SwigInterface/manta.i

  Added releasing of the python GIL to
  MantaInterface::blockUntilFinished, and
  SyncDisplay::waitOnFrameReady.

SwigInterface/wxManta.py

  Made things much less chatty.

  When closing the window the application actually exits all the way,
  cleanly.


Modified: trunk/SwigInterface/manta.i
==============================================================================
--- trunk/SwigInterface/manta.i (original)
+++ trunk/SwigInterface/manta.i Mon May  1 12:53:37 2006
@@ -96,8 +96,9 @@
   
 };
 
-// This will un
+// This will unlock the GIL for potentially locking functions
 %manta_Release_PythonGIL(Manta::MantaInterface::addTransaction);
+%manta_Release_PythonGIL(Manta::MantaInterface::blockUntilFinished);
 
 %include <Interface/UserInterface.h>
  
@@ -221,6 +222,8 @@
 #include <Engine/Display/OpenGLDisplay.h>
   //#include <Engine/Display/PureOpenGLDisplay.h>
 %}
+
+%manta_Release_PythonGIL(Manta::SyncDisplay::waitOnFrameReady);
 
 %include <Interface/ImageDisplay.h>
 %include <Engine/Display/SyncDisplay.h>

Modified: trunk/SwigInterface/wxManta.py
==============================================================================
--- trunk/SwigInterface/wxManta.py      (original)
+++ trunk/SwigInterface/wxManta.py      Mon May  1 12:53:37 2006
@@ -49,7 +49,6 @@
     lights.add(manta_new(PointLight(Vector(5,0,8), 
Color(RGBColor(.1,.6,.1)))))
     lights.add(manta_new(PointLight(Vector(5,5,2), 
Color(RGBColor(.2,.2,.2)))))
     lights.setAmbientLight(manta_new(ConstantAmbient(Color.black())))
-    print lights
     #
     scene.setLights(lights)
     scene.getRenderParameters().maxDepth = 5
@@ -76,12 +75,13 @@
 
     def run(self):
         """DisplayThread run function."""
-        print "DisplayThread::run()::start"
         while(not self.want_abort):
-            if (self.sync_display.frameReady()):
+            self.sync_display.waitOnFrameReady();
+            # We need to check the state of the thread one more time
+            # before triggerring another event (which blocks and keeps
+            # the program from exiting properly.
+            if (not self.want_abort):
                 wx.PostEvent(self.notify_window, FrameReadyEvent())
-            else:
-                time.sleep(0.00001)
 
     def abort(self):
         """abort this thread."""
@@ -154,17 +154,14 @@
         self.sync_display.setChild(display)
         self.Connect(-1,-1, EVT_MANTA_FRAME_READY_ID, self.OnFrameReady)
         self.sync_thread = DisplayThread(self, self.sync_display)
-        print "After DisplayThread()"
 
         # Create a display channel.
         self.engine.createChannel( self.sync_display, camera, use_stereo, 
xres, yres )
 #        self.engine.createChannel( display, camera, use_stereo, xres, yres )
-        print "After createChannel()"
 
         # Basic scene.
         self.engine.setScene( createDefaultScenePython() )
         self.engine.beginRendering(False)
-        print "After beginRendering()"
 
         
#######################################################################
         # Setup the UI events.
@@ -189,6 +186,7 @@
         print "Exiting the engine"
         self.sync_thread.abort()
         self.engine.finish()
+        self.sync_display.doneRendering()
         self.engine.blockUntilFinished()
         print "Engine exited"
 




  • [MANTA] r1030 - trunk/SwigInterface, bigler, 05/01/2006

Archive powered by MHonArc 2.6.16.

Top of page