librtl

Simple

This example demonstrates very simple basic usage of this library. The code renders a sphere whose transformation matrix makes it viewable from 5 world space units away. The default light is used (See Light). The rendered image is then written to standard output.
#include <iostream.h>
#include <rtl/rtl.h>

void main()
{
    rtl_initialize();

    rtl_world scene;
    jImage bfr(200,200);
    rtl_material redm(jColour::red);
    
    rtl_sphere sphere;

    scene.translate(0,0,-5);
    
    scene.material(&redm);

    scene.add(&sphere);

    cerr.setf(ios::fixed);
    cerr.precision(3);
    
    scene.raytrace(bfr);
    
    jImage::writePPM(cout,bfr);

    rtl_terminate();
}


JSP / librtl v0.2 mtigges@cpsc.ucalgary.ca