Jump to content

Linking renderman with c api?


Recommended Posts

Does any1 know how to link renderman with devc++ or any other c/c++ compliers?

Or in a nutshell.... how in the world do I connect the c api to renderman? So that when I make a c file it will compile it out to rib....

heres a test code... Please any help will be appreicated...

/* color.c - Create Particles of different colors*/

#include <ri.h>

#include <math.h>

#define COUNT 2000

#ifdef WIN32

#define random rand

#endif

float jitter(float scale)

{

float val=random()%1000;

return (val/500-1)*scale;

}

int main(int argc, char *argv[])

{

RtPoint position[COUNT];

RtColor color[COUNT];

float constantwidth=0.5;

float fov=30;

int i;

/*Generate Particle Postions*/

for(i=0;i<COUNT;i++)

{

position[0]=sin(i*0.5)*50+jitter(2);

position[1]=cos(i*0.1)*50+jitter(2);

position[2]=cos(i*0.5)*100+jitter(2);

color[0]=jitter(0.5)+0.5;

color[1]=jitter(0.5)+0.5;

color[2]=jitter(0.5)+0.5;

}

RiBegin(RI_NULL);

RiDisplay ("color.tiff","file","rgb",RI_NULL);

RiProjection ("perspective",

"fov",&fov,

RI_NULL);

RiWorldBegin();

RiTranslate(0,0,300);

RiPoints(COUNT,"P",position,

"constantwidth", &constantwidth,

"Cs",color,

RI_NULL);

RiWorldEnd();

RiEnd();

return 0;

}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...