Greetings everyone!
First of all, I have already posted this on the nvidia forums, but people seem to not want to answer / cannot answer etc. So I want to try my luck here.. :)
---
I am creating a state manager for CgFX.
I am caching (registering) the states in an std::map like so:
// cache states
CGstate state = cgGetFirstState(mContext);
while(state)
{
// get state name
String stateName = cgGetStateName(state);
// create effect state -- this is a custom struct that wraps some data
EffectState* effectState = new EffectState();
effectState->CRC = 0;
effectState->Name = stateName;
effectState->Type = cgGetStateType(state);
// save state
mStates[state] = effectState;
// setup callback functions -- CALLING THIS FUNCTION MESSES UP MY TEXTURES!
cgSetStateCallbacks(state, Effect::stateSet, Effect::stateReset, Effect::stateValidate);
// next!
state = cgGetNextState(state);
}
Note how I call cgSetStateCallbacks(). If I don't do that, everything works fine. If I do that, however, my textures don't get set anymore. This doesn't work anymore:
cgD3D9SetTextureParameter(aParameter, d3d9Texture);
cgSetSamplerState(aParameter);
And this is the texture/sampler variable in the shader:
uniform sampler2D gDiffuseMap : DIFFUSEMAP = sampler_state
{
WrapS = Repeat;
WrapT = Repeat;
};
So in conclusion: I call cgSetStateCallbacks() turns my objects black. Why is this?