PDA

View Full Version : First shader crashes my maya


phantastikfan
05-09-2005, 02:43 PM
Hi everybody,

i ran into problems with my first shader. the following peace of code causes my maya to crash when rendering:
mi_query(miQ_DECL_VERSION, state, 0, &version); where version is a integervariable.
that line of code causes the same problem:
mi_point_to_object(state, &vec, &state->point); where vec is a miVector variable

I assume that the problem is the pointers given to the functions, but why? I hope you can help me, i'm desperatly trying to find the reason since hours.

greets
phantastikfan

craigd
05-18-2005, 01:07 PM
mi_query(miQ_DECL_VERSION, state, 0, &version);
...will crash because you pass a null pointer in. You shouldn't need the state, just an miTag whose type is miSCENE_FUNCTION_DECL.
e.g.

const miFunction *func = state->shader;
miTag decl = func->function_decl;
int version;
mi_query(miQ_DECL_VERSION, NULL, decl, &version);
fprintf(stderr, "version %d\n", version);

Not sure why the mi_point_to_object crashes, works fine for me.

phantastikfan
05-18-2005, 01:18 PM
Thanks for the answer, but I've solved the problem by myself. The problem was not the source code, but the compiler. When i compiled the shader with another compiler it worked fine.
Don't know what the problem was with that compiler.

CGTalk Moderation
05-18-2005, 01:18 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.