WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Plug-in development (https://forum.worldviz.com/forumdisplay.php?f=8)
-   -   PyOpenGL plugin (https://forum.worldviz.com/showthread.php?t=2301)

JimC 10-05-2009 02:27 PM

PyOpenGL plugin
 
For my custom-node learning exercise I hacked out a plugin for writing custom nodes in Python with PyOpenGL. Not too pretty, but it hardly ever crashes Vizard anymore. :rolleyes:
In case anyone's interested...

farshizzo 10-05-2009 02:43 PM

Sweet!

Does the custom node call a specified Python function from inside the draw method? If so, you will need to make sure the plugin acquires the Python global interpreter lock before triggering the Python code. This might be the cause of the crashes you mention. Example:
Code:

PyGILState_STATE pyGILState = PyGILState_Ensure();

//Run Python code

PyGILState_Release(pyGILState);


JimC 10-06-2009 07:15 AM

Yes, I've got all the Python calls properly wrapped in GIL Ensure()/Release() calls. I'm somewhat familiar with the Python C API (I did most of the work on the Python bindings for Syzygy, with SWIG and more recently SIP), but I find it so verbose and tedious that there's a strong temptation to be sloppy about validating the results...I think I've got it fixed up now...


All times are GMT -7. The time now is 07:34 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC