Part 2: Making RIB with libribout.a
revised 27 August 1998
Larry I. Gritz
gritzl@acm.org
You may wish to write a C or C++ program which makes calls to the procedural interface, resulting in the output of RIB. The resulting RIB may be piped directly to another process (such as a previewer), or redirected to a file for later rendering. The library libribout.a does this. This library provides a `C' language binding for the RenderMan Procedural Interface.
You can link libribout.a in the usual way to your `C' programs which make the various Ri procedure calls. The following example shows how to link with this library on a typical Unix machine:
cc myprog.c -o myprog -lribout -lm
This will result in an executable, myprog, which outputs RIB requests to standard output. This may be redirected to a specific RIB file as follows:
myprog > myfile.ribRemember that the RiBegin statement usually only takes the argument RI_NULL:
RiBegin (RI_NULL);
The default of sending RIB to stdout can be overridden by providing a filename to the RiBegin statement in your program. For example, suppose your program contains the following statement instead:
RiBegin ("myfile.rib");
In this case, the RIB requests corresponding to the Ri procedure
calls will be sent to the file "myfile.rib" rather than to standard
output. In addition, if the filename you specify starts with the '|'
character, the library will open a pipe to the file specified
after the '|' symbol. For example, RiBegin ("|rgl");
will
cause the RIB you produce to be piped directly to a running rgl
process without creating an intermediate RIB file.
Remember to tell the C compiler where the ri.h
and
libribout.a
files are, or it won't be able to find them.
On most platforms, BMRT is also distributed with a dynamic
library, libribout.so
(or perhaps
libribout.so.2.3.6
). This library performs the same
function as libribout.so
, but is a dynamic library, which
means that it is shared by all programs that link against it, rather
than being separately copied into every resulting executable needs the
library. Please consult the manual pages to your C compiler, or your
local system administrator, for the fine points of using dynamic
libraries.
This document last updated 27 Aug 98 by gritzl@acm.org
All BMRT components are Copyright 1990-1998 by Larry I. Gritz. All rights reserved.
The RenderMan Interface Procedures and RIB Protocol are: Copyright 1988, 1989, Pixar. All rights reserved. RenderMan is a registered trademark of Pixar.