🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.next.programmer
Article #2228

Re: Getting Renderman examples involving RiLightSource to work?

#2228
From: Joseph Goldstone
Date: Thu, 07 Jan 1993 13:05
68 lines
3064 bytes
Peter Milne writes
> Following advice from other recent posters I managed to get the simple
> Renderman example on page 18 of "The Renderman Companion" to work.
> Unfortunately thought, I haven't been able to get the next example on
> page 20 to work.  This example involves a RiLightSource call.
> When I execute this example I get the following warning msg:
> 
> 	Warning in context RMContext00001 in command RiLightSource :
> 	nullpointer: 'light' == 0
> 
> and nothing involving the specification of the lightsource gets written into
> the .rib file.
> 
> Now I've tried it with and without the following RiOption
> 
> 	RiOption(RI_ARCHIVE, "outputversion", &v31, RI_NULL);
> 
> The release notes for 3DKit say not to use this form of RiOption because
> the version number doesn't get correctly written to the .rib file
> and that instead you should use RiComment("\nversion 3.1");  Trouble is
> RiComment doesn't seem to be in Media_s or NeXT_s and isn't commented
> anywhere that I could find.
> 
> The release notes also say that this form of RiOption causes RiLightSource
> to generate invalid sequence numbers and that it should be avoided.
> 
> Has anyone succeeded in getting the page 20 example to work?  Is so how
> did you do it?
> 

RiLightSource underwent a sea-change post 3.1, to accomodate some interface  
changes involving handle scoping.

Try this:
#import <ri/ri.h>

RtPoint Square[4]={{.5,.5,.5}, {0.5,-.5,.5}, {-.5,-.5,.5}, {-.5,.5,.5}};

RtColor Color = {.2, .4, .6};
RtToken myDistantHandle;

int main(void)
{
  char *archive = "archive";
  char *ribfile = "pg20.rib";
  RiBegin(RI_NULL, "renderer", &archive, "filepath", &ribfile, RI_NULL);
    RiDisplay("pg20.tiff", RI_FILE, RI_RGBA, RI_NULL);
    myDistantHandle = RiCreateHandle("myDistantHandle", RI_LIGHTSOURCE);
    RiLightSource(myDistantHandle, "distantlight", RI_NULL);
    RiProjection("perspective", RI_NULL);
    RiTranslate(0.0,0.0,1.0);
    RiRotate(40.0,-1.0,1.0,0.0);
    RiWorldBegin();
      RiSurface("matte", RI_NULL);
      RiColor(Color);
      RiPolygon(4, RI_P, (RtPointer) Square, RI_NULL);
    RiWorldEnd();
  RiEnd();                                                               
  return 0;
}

If you like you can collapse the pedantic RiCreateHandle/RiLightSource couplet  
into:
  myDistantHandle = RiLightSource("myDistantHandle", "distantlight", RI_NULL);
which also works. This version is more or less what's documented on p.21 of the  
QRM beta release notes in Digital Librarian.

-- joseph
Technical Details
Message-ID: <1993Jan7.130546.1519@lilliput.fdn.org>
Path: arc1-ca.pugleaf.net!sparky!uunet!arakis.fdn.org!gamb.fdn.org!lilliput!joseph
References: <1993Jan4.000209.14805@csis.dit.csiro.au>

Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.next.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!arakis.fdn.org!gamb.fdn.org!lilliput!joseph
From: joseph@lilliput.fdn.org (Joseph Goldstone)
Subject: Re: Getting Renderman examples involving RiLightSource to work?
Message-ID: <1993Jan7.130546.1519@lilliput.fdn.org>
Keywords: renderman
Sender: joseph@lilliput.fdn.org
Organization: Lilliputian Pictures - Paris, France.
References: <1993Jan4.000209.14805@csis.dit.csiro.au>
Date: Thu, 7 Jan 1993 13:05:46 GMT
Lines: 68