Ok,
this is a short tutorial I've put together as a way for myself to
learn the process of compiling RenderMan programs using BMRT 2.6 under VC++ 7
(a.k.a. .NET), but I hope other beginners will be able to benefit from it as
well. This is a great spot to mention that the libraries for the Windows
version of BMRT were compiled under VC++ , therefore you must use VC++ to
compile. If you want to use a different compiler (g++ under Cygwin or Dev-C++)
you may be able to use the libraries in the Affine Toolkit, found at www.affine.org.
I have yet to try them, but if I do and have success I'll try another tutorial.
A
great deal of this information has been gleaned from the Google group
comp.graphics.rendering.renderman. Thanks to all the people who post to that group.
First,
if you just want to compile a simple program like colorspheres.c (included with
BMRT) from the command line and avoid the IDE, try the following...
Start -> Programs -> Microsoft
Visual Studio .NET -> Visual Studio .NET Tools -> Command Prompt
cd to the examples directory (my
drive is D:, yours may be C:)...
D:\>cd BMRT2.6\examples
Now compile and link...
D:\BMRT2.6\examples>cl /I..\include
colorspheres.c /link D:\BMRT2.6\lib\libribout.lib /out:colorspheres.exe
There should now be a file named
colorspheres.exe in the examples directory. To see it run try...
D:\BMRT2.6\examples>colorspheres.exe
rgl
That's
it for command line, now lets use the IDE..
Start -> Programs -> Microsoft
Visual Studio .NET -> Microsoft Visual Studio .NET
File -> New -> Project ->
Visual C++ Projects
Project Types: Visual C++ Projects
-> Win32 Project: Fill in the project Name and Location
Application Settings: Select Console
application and Empty project -> Finish
I have read that there are
complications when trying to compile a GUI application with the libs used here,
so I am sticking to console applications for now. If I learn more later, or if someone wants to provide more
information I'd be glad to add it.
Now we should have the Start Page to
the left and the Solution Explorer to the right.
In the Solution Explorer right click on Source Files -> Add
-> Add Existing Item: Navigate to the examples directory, select
colorspheres.c and Open.
If you need to add to Header Files, e.g.
ri.h or slc.h, you do it the same way you added to Source Files colorspheres.c.
To add an include directory right click
colorspheres -> Properties to get the Property Pages...
…then Configuration Properties ->
C/C++ -> General -> Additional Include Directories and add the path
(e.g. D:\BMRT2.6\include).
O.K., we're almost done. The last
thing to do is add Linker information, so right click colorspheres ->
Properties to get the Property Pages.
First, go to Configuration Properties
-> Linker -> General. Under Additional Library Directories add the path to your lib directory (e.g. D:\BMRT2.6\lib)
Next, go to Configuration Properties
-> Linker -> Input. Under Additional Dependencies add libribout.lib and
libslcargs.lib and under Ignore Specific Library add libc.lib.
libslcargs.lib is not needed to compile
colorspheres.c, but I leave it there for other projects.
Adding libc.lib suppresses a linker
warning. See comp.graphics.rendering.renderman for detail.
Now we compile. Right click
colorspheres -> Build. If all is correct there should be an executable file
named colorspheres.exe in the D:\BMRT2.6\Projects\debug directory. So, using
your favorite console (mine is Cygwin) move to the debug directory and try
something like...
colorspheres.exe rgl
A small window should open and the
animation should run. If it doesn't
work, either you have made a mistake or I have written a poor tutorial. If it
is the latter please let me know and I will try to make improvements.
That’s it for now. Best of luck and
let me know if this has been of any use to you.
Kevin