Resources > Pitfalls


Placement of statements in a VRUT script
Some VRUT statements can only be placed at certain locations within a script.  The limitations that are known are the following:

  1. When using callbacks, you should avoid doing much at the global level of the script. The safest method is to place as much of your initialization steps inside a function that gets called at the beginning of running your script.  This include standard OS file access utilities.  The one exception are the add_ commands (see next item).
  2. Do not place the following commands inside a function: addchild, addsensor, addtexture, and addmail.  Doing so will cause VRUT to hang indefinitely.  There is a workaround if you really must break this rule, and that is to wrap around a vrut.execute command around the add_ function.  For example, you could run vrut.execute("a = vrut.addchild('foo.wrl')") and it would work.
There is some quantization occurring with the timers that hasn't been entirely debugged yet, so be careful when setting up times that are meant to run at the display device's frame rate.  The safest method is to leave out the expiration time and let VRUT use the optimal time for you automatically.  If you choose to set the time manually, be aware that passing 0.001 for a 1/60 Hz device may still not give you 60 Hz animation while passing 0.00001 does seem to.

Difference between OpenGL accelerator cards
For whatever reason, OpenGL behaves slightly differently on different hardware manufacturer's accelerator cards.  The situations in which this has been noticed are the following:

  1. When combing non-texture and texture objects in one scene, the safest method seems to be to add all non-textured object first.  Some accelerator cards will render the non-textured object as pure white and non-shaded if you don't do this.
  2. Running on a machine with no OpenGL acceleration sometime produces texture map "swimming".


Building C extensions to Python
Start with 1.52, you must included both python15.lib and python15_d.lib in the project.  If you build with just python15_d.lib, it will link OK but when you try and import the module into Python you'll get an error message that it could find the named function.  Just adding 'python15.lib' won't immediately fix it--you must first remove the debug lib, rebuild, then add both libs and then rebuild again to clear up this problem.  I don't want to admit how long it took me to figure that one out one day!