From: Ari H. <ahe...@an...> - 2000-10-18 20:51:13
|
On Wed, Oct 18, 2000 at 11:22:19AM -0700, Richard H. C. Seabrook wrote: > Hello, I'd like to generate a plot in VPython and output it to a JPG on > the fly so I can display the results of vector comparisons on a web > page. If this has been discussed before, please point me to > it. Otherwise, anyone have a suggestion for how to go about it? Not hard, believe it or not. You need to reach inside VPython to make the GL contexts available to Python. Then, in PyOpenGL, you just do glGetPixels (iirc) and write the results to whatever format you want (presumably you build raw's, and use another library to convert to jpegs). The problem is, the visual library is designed to be used interactively. You'll have a hard time doing anything like running simulations as demanded by a webserver or anything like that -- for example on Unix at least you'd need to have a DISPLAY set so that GL would know where to draw to. But you could hack around that and make it go :) In theory you could VPython more efficient for this type of thing by having a mode where it only runs simulation, and renders to a file automatically when the control program tells it to. Wouldn't be hard to write at all, i don't think (but ianal). Ari |