Notifications
Clear all
[Closed] Writing C++ mental ray shader
Sep 05, 2008 4:41 pm
What do I have to do to get shader compiled as C++ to work?
Here is a test shader, compiling it with VS2005 as C it works, if I switch to C++ it doesn’t.
#include "shader.h"
DLLEXPORT int color_test_texture_version(void) {
return(1);
}
DLLEXPORT miBoolean color_test_texture (miColor *result, miState *state, void *params) {
result->r = 1.0;
result->g = 0.5;
result->b = 0.25;
result->a = 1.0;
return miTRUE;
}
Is there some specific setting I have to turn on or what?
2 Replies
Sep 05, 2008 4:41 pm
Hi Jerry,
have you taken a look at the PDF “Compiling mentaly ray shaders” available here:
http://www.jeffpatton.net/Downloads.htm
It covers how ro set up VS to compile the shaders.
If you’ve already done all of that and it still doesn’t work, let me know and I can mail you a simple C++ project that you can pull apart.
Dave
Sep 05, 2008 4:41 pm
Yeah I hadn’t taken a look at it. The thing I was missing was ‘extern “C”’ from the begining of dllexports, now it works. Thanks Dave!
- Jerry