POV-Ray : Newsgroups : povray.programming : beginner : Re: beginner Server Time
28 Jul 2024 16:15:24 EDT (-0400)
  Re: beginner  
From: Thorsten Froehlich
Date: 23 Mar 2000 22:24:53
Message: <38dae005@news.povray.org>
In article <38DAC995.1872DBF6@dial.oleane.com> , Riccardo Cohen 
<rco### [at] dialoleanecom>  wrote:

> It is the opposite : I would like not to lauch povray manually, nor loading a
> file on disk. I would like my C++ program to "send" as tranparantly as
> possible a pov file to povray, and "receive" the image automatically, without
> any manual manipulation. (mac+win)

The following, while never tested, should work with the Mac version. In
order to start rendering, you can use AppleScript with a few tricks to
actually start the render automatically.  To do so, you can send a "print"
event with the file to render.  The render will auto-start with the settings
of that file or if none exists, the default settings (you can find the prefs
resource format in the official source code if you want to create/change
prefs in your application).
Now comes the catch: You won't get an event back when rendering is done.
There are several ways to solve this. I would suggest the following trick.
As output format select an uncompressed Targa image. Now, you can
pre-calculate the size of the Targa image in advance, it is a fixed header
size plus width * height * bytes per pixel (usually three or four). You can
look it either up in the POV-Ray source code or just render a few images and
do the math based on that.
Now, just make your application check every few seconds if the image file in
questions already exists (remember to delete it before starting the render
if it exists), and if it exists, check its size. If the size matches the
size you expect, the render is done. As Targa images are written on a line
by line bases, you can theoretically even get a line by line preview.

Good luck,


    Thorsten


____________________________________________________
Thorsten Froehlich
e-mail: mac### [at] povrayorg

I am a member of the POV-Ray Team.
Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.