From: Press, S. <sha...@ai...> - 2003-02-10 22:33:33
|
This is based on my own attempts at building a frustum, which BTW may not be the best choice of name as 'frustum' in OpenGL refers to the Perspective Viewing Volume and therefore turns up in the source in another context. This was done under RedHat Linux 7.3 and both VPython and Python 2.2.1 were local copies rather than system installations 1. Use the source, Luke 2. It is easier to modify then write your own 3. Find an existing primative to base your shape on. In the case of a frustum, the cone shape is the best bet 4. Copy cone.cpp to frustum.cpp 5. Change references to 'cone' to 'frustum' in fustrum.cpp 6. Modify how the shape is to be drawn (I'm not going to go into detail on this as I haven't got it quite right yet!) 7. Edit cvisual.cpp to include the frustum command. The easiset way to do this is to find every reference to cone and add an identical reference using the word frustum instead of cone 8. Edit Makefile and add fustrum.cpp to the list of source files 9. Find the directory site-packages/visual in the source tree. Modify __init__.py to include the label frustum. Again, just look for cone and add fustrum at that point. 10. Run make 11. If you are building against the system installation, run make install. If not copy cvisualmodule.so to <local python dir>/Lib .Copy the modified __init__.py file into the <local python dir>/Lib/site-packages/visual directory. If you do not do this, the attempts to run frustum() under python will return an error 12. Test by starting python from visual import * f = frustum() If something appears, great. If an error is returned, check that the site-package/visual directory is in sys.path. If not use sys.path.insert(2,<site package path>) to add it to sys.path (don't forget to import sys before you do this) The way David Scherer wrote Visual Python makes building simple shapes pretty easy. You can get by with a minimal knowldege of OpenGL as the source is fairly easy to follow. Obvious question:Have I built a frustum? Sort of. I have made something that looks like one, but It isn't quite what I think people want. I should have better results in the next couple of days, when I improve the shape generation (step 6) Other shapes that should be fairly easy to make include Pyramids, domes, eggs, diamonds and maybe non-rectangular prisms |