Drawing in 3D view?

Hi Everyone,

I would like to be able to create a “custom object” using Python, which is drawn in a 3D view (alongside normal meshes, empties, curves, etc.).

I’m aware of the BGL module, but this seems to draw only in the script window. What I’m after is something that can draw in the 3D view.

This is for an application in biomechanics modeling. I have a skeleton model to which I would like to add muscle paths as custom objects. These muscle paths are constructed from several basic sub-objects:
- Origins and insertions of muscles (basically points).
- “Spherical pulleys” over which the muscles pass at the joints.

I can already create representations of these objects as meshes using a “wizard”-style script, that can update everything each frame. This is useful for generating illustrations, but is slow and cumbersome for realtime viewing. Is there any way for me to draw directly in the 3D view itself using OpenGL?

Thanks,

Jonathan Merritt.

Check this example:

www3.sympatico.ca/emilio.aguirre/hornextrude.html

Use the object link property to assign the drawing script on an object.

BGL should work in the 3dview window, I have a circle around the mouse that uses BGL (wil release an updated version of my script that has the circle later today). You need to use Window.QRead() and related functions and not Draw.Register().

For some reason the Draw Register is designed to only do events in the scripts window.

LetterRip

Thanks everyone! :smiley: