OpenGL and RenderMan - Rendering
[ contents ]
Rendering

RenderMan

Code calling the RenderMan Interface creates a RIB(RenderMan Interface Bytestream) file that contains all of the what is to be rendered by your Renderman compliant rendering application(BMRT). You invoke the Interface and start the RIB file by calling RiBegin() at the head of your program.

OpenGL

The simplest way to render a frame of your animation in OpenGL is to use system() to send a shell command after your call to glutSwapBuffer(), and before you exit the display() routine, to scrsave.


RiDisplay(char *name, RtToken type, RtToken mode, ... )

If type is "file", name is the name of the file to which the current image should be saved. If type is "framebuffer", it denotes the name of the framebuffer in which to display the image. mode is a string, in double quotes, which gives the file type of the image. mode maybe be any combination of "rgb", "a", and "z".

char filename[30];

RiBegin();

sprintf(filename, "image.%d.tif", frame);
RiFrameBegin();

RiDisplay(filename, "file", "rgba", RI_NULL);
... draw your stuff here

RiFrameEnd();
RiEnd();

*Note - exporting RIB from your OpenGl animation applications slightly impacts your frame rate during playback.

renderframe(frame)

renderframe() sends Unix a shell command that executes scrsave at the provided screen coordinates and to save the frame as image.#.rgb, where # is the int frame.

void renderframe(int frame)
{

extern char movie[];

sprintf(movie, "/usr/sbin/scrsave /usr/tmp/image.%d.rgb 8 648 8 488", frame);

system(movie);

if((initframe+movfr) < (initframe + frameend))
++movfr;
}

*Note - This significantly slows down your frame rate during playback.


This image was rendered off-line with anti-aliasing using BMRT.

This image was rendered in real-time during playback, without anti-aliasing.