home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / next / programm / 8023 < prev    next >
Encoding:
Text File  |  1993-01-07  |  2.9 KB  |  81 lines

  1. Newsgroups: comp.sys.next.programmer
  2. Path: sparky!uunet!arakis.fdn.org!gamb.fdn.org!lilliput!joseph
  3. From: joseph@lilliput.fdn.org (Joseph Goldstone)
  4. Subject: Re: Getting Renderman examples involving RiLightSource to work?
  5. Message-ID: <1993Jan7.130546.1519@lilliput.fdn.org>
  6. Keywords: renderman
  7. Sender: joseph@lilliput.fdn.org
  8. Organization: Lilliputian Pictures - Paris, France.
  9. References: <1993Jan4.000209.14805@csis.dit.csiro.au>
  10. Date: Thu, 7 Jan 1993 13:05:46 GMT
  11. Lines: 68
  12.  
  13. Peter Milne writes
  14. > Following advice from other recent posters I managed to get the simple
  15. > Renderman example on page 18 of "The Renderman Companion" to work.
  16. > Unfortunately thought, I haven't been able to get the next example on
  17. > page 20 to work.  This example involves a RiLightSource call.
  18. > When I execute this example I get the following warning msg:
  19. >     Warning in context RMContext00001 in command RiLightSource :
  20. >     nullpointer: 'light' == 0
  21. > and nothing involving the specification of the lightsource gets written into
  22. > the .rib file.
  23. > Now I've tried it with and without the following RiOption
  24. >     RiOption(RI_ARCHIVE, "outputversion", &v31, RI_NULL);
  25. > The release notes for 3DKit say not to use this form of RiOption because
  26. > the version number doesn't get correctly written to the .rib file
  27. > and that instead you should use RiComment("\nversion 3.1");  Trouble is
  28. > RiComment doesn't seem to be in Media_s or NeXT_s and isn't commented
  29. > anywhere that I could find.
  30. > The release notes also say that this form of RiOption causes RiLightSource
  31. > to generate invalid sequence numbers and that it should be avoided.
  32. > Has anyone succeeded in getting the page 20 example to work?  Is so how
  33. > did you do it?
  34.  
  35. RiLightSource underwent a sea-change post 3.1, to accomodate some interface  
  36. changes involving handle scoping.
  37.  
  38. Try this:
  39. #import <ri/ri.h>
  40.  
  41. RtPoint Square[4]={{.5,.5,.5}, {0.5,-.5,.5}, {-.5,-.5,.5}, {-.5,.5,.5}};
  42.  
  43. RtColor Color = {.2, .4, .6};
  44. RtToken myDistantHandle;
  45.  
  46. int main(void)
  47. {
  48.   char *archive = "archive";
  49.   char *ribfile = "pg20.rib";
  50.   RiBegin(RI_NULL, "renderer", &archive, "filepath", &ribfile, RI_NULL);
  51.     RiDisplay("pg20.tiff", RI_FILE, RI_RGBA, RI_NULL);
  52.     myDistantHandle = RiCreateHandle("myDistantHandle", RI_LIGHTSOURCE);
  53.     RiLightSource(myDistantHandle, "distantlight", RI_NULL);
  54.     RiProjection("perspective", RI_NULL);
  55.     RiTranslate(0.0,0.0,1.0);
  56.     RiRotate(40.0,-1.0,1.0,0.0);
  57.     RiWorldBegin();
  58.       RiSurface("matte", RI_NULL);
  59.       RiColor(Color);
  60.       RiPolygon(4, RI_P, (RtPointer) Square, RI_NULL);
  61.     RiWorldEnd();
  62.   RiEnd();                                                               
  63.   return 0;
  64. }
  65.  
  66. If you like you can collapse the pedantic RiCreateHandle/RiLightSource couplet  
  67. into:
  68.   myDistantHandle = RiLightSource("myDistantHandle", "distantlight", RI_NULL);
  69. which also works. This version is more or less what's documented on p.21 of the  
  70. QRM beta release notes in Digital Librarian.
  71.  
  72. -- joseph
  73.