POV-Ray : Newsgroups : povray.general : C API Server Time
23 Nov 2024 20:23:29 EST (-0500)
  C API (Message 1 to 3 of 3)  
From: Kima
Subject: C API
Date: 5 Feb 2023 20:25:00
Message: <web.63e055d2bda0392d65103170d427f3e5@news.povray.org>
I try to use POV-Ray in C. I have two versions of POV-Ray 3.7 and 3.7 installed
via the Ubuntu official repository and from the source, respectively.

However, I am unable to find the corresponding C header (povray.h) anywhere to
compile the script.

I have a simple script of

#include "povray/povray.h"

int main(int argc, char *argv[])
{
    // Initialize the POV-Ray API
    povray_init(argc, argv);

    // Define the sphere object
    povray_sphere_t sphere;
    sphere.center.x = 0;
    sphere.center.y = 0;
    sphere.center.z = 0;
    sphere.radius = 1;

    // Specify the properties of the sphere
    povray_material_t material;
    material.diffuse.red = 1;
    material.diffuse.green = 0;
    material.diffuse.blue = 0;

    // Add the sphere to the scene
    povray_add_sphere(&sphere, &material);

    // Render the image
    povray_render("sphere.png", 640, 480);

    // Clean up
    povray_cleanup();

    return 0;
}

How can I install/find -lpovray library for C?


Post a reply to this message

From: William F Pokorny
Subject: Re: C API
Date: 6 Feb 2023 01:45:56
Message: <63e0a224$1@news.povray.org>
On 2/5/23 20:20, Kima wrote:
> How can I install/find -lpovray library for C?

There is no POV-Ray C / C++ API or library.

In other words, all that is POV-Ray specific is today included as part 
of the povray load module. POV-Ray itself, makes use of other libraries.

Bill P.



More of me yapping for those wishing to trudge onward...

An official API has discussed at various times in the past - and I'd 
make a guess bits of the main body you posted comes from such a 
discussion thread! :-)

Christoph invested considerable time trying to untangle the code 
(v3.8/v4.0) to better set up for support of an API with a library build, 
but that code re-factoring start is as far as work got.

It's possible to write custom C++ making use of the POV-Ray code base to 
render scenes. Somewhere on the news groups Christoph worked up and 
posted C++ code which manually made all the necessary calls to render a 
sphere IIRC. The work was done to look at the feasibility of 'just' 
coding scenes in C++ as some had suggested at the time. His conclusion 
was it would be a difficult way to create and render scenes in practice.

FWIW. You can find povray.h in the 'source code' tree at:
./source/backend/povray.h. There have been changes to this file over 
time, but I think v3.7/v3.8/v4.0 consistent with respect to file 
location at least, though not the file's contents.


Post a reply to this message

From: Kima
Subject: Re: C API
Date: 6 Feb 2023 02:55:00
Message: <web.63e0b180529be29b65103170d427f3e5@news.povray.org>
Thanks for letting me know. I understand the underlying difficulty to do so. I
hope to see it one day. It would be very beneficial to render within the script,
particularly for animations.


Post a reply to this message

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