PDA

View Full Version : Another question for MR Shader compiling in VS2003


Kasper Larsen
April 20th, 2006, 22:08
Hi....

I am all new to writting shader for MR, and I need a little help getting started. I have copied this simple shader code from the mental ray documentation into VS2003 and I wish to compile it.

#include <stdio.h>
#include "shader.h"

struct mytexture { miScalar min, max; };

int mytexture_version(void) {return(1);}

miBoolean mytexture(
miColor *result,
miState *state,
struct mytexture *paras)
{
miVector vec;
miScalar min, max;

mi_point_to_object(state, &vec, &state->point);
min = *mi_eval_scalar(&paras->min);
max = *mi_eval_scalar(&paras->max);
result->r = vec.x < 0 ? min : max;
result->g = vec.y < 0 ? min : max;
result->b = vec.z < 0 ? min : max;
result->a = 1;
return(miTRUE);
}

When I try to build the DLL library I get the following error message:
error LNK2001: unresolved external symbol "void * __cdecl mi_phen_eval(struct miState *,void *)" (?mi_phen_eval@@$$J0YAPAXPAUmiState@@PAX@Z)

I also get a warning saying:
warning LNK4243: DLL containing objects compiled with /clr is not linked with /NOENTRY; image may not run correctly


Do I need to set any parameters or link to somthing to be able to compile this shader? I hope someone can give a short summarize of how to compile a shader (including setting any environment variables ect.)

Thanks
Kasper

dlanier
April 20th, 2006, 22:15
Hi,

Did you link with shader.lib ?
Regards,

Kasper Larsen
April 20th, 2006, 22:20
How do I link to the shader.lib file? I can't seem to find it in the mental ray folder.

Maybe I should add, that I use Maya 7.0 and the accompanying mental ray

Thanks for the qiuck reply... :)

dlanier
April 20th, 2006, 22:27
The lib is in :
C:\Program Files\Alias\Maya7.0\devkit\mentalray\lib\nt

The include in :
C:\Program Files\Alias\Maya7.0\devkit\mentalray\include

Replace the C:\Program Files\Alias\Maya7.0 with your maya path if this is not the same.
Regards,