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(¶s->min);
max = *mi_eval_scalar(¶s->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
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(¶s->min);
max = *mi_eval_scalar(¶s->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