Jump to content
  • Advertisement
Sign in to follow this  
Anddos

Setting a material for a mesh with .fx

This topic is 2405 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I seem to be having a problem figuring out how to set a meshs materials using .fx shaders
In the shader fx its not letting define a Mtrl handle like this,

texture g_txScene;
Mtrl gMtrl;

ive tried Material ,material and both cause the exe to crash sad.png

to render i am doing this


effect->Begin(NULL, NULL); // begin using the effect
effect->BeginPass(0); // begin the pass

for(DWORD i = 0; i < numMaterials; i++) // loop through each subset
{
// render whatever

effect->SetValue(Material,&material, sizeof(material)));
effect->SetTexture(Texture,texture);
meshSpaceship->DrawSubset(i); // draw the subset

}

effect->EndPass(); // end the pass
effect->End(); // end the effect

Share this post


Link to post
Share on other sites
Advertisement
Material is rather a thing from the fixed pipeline processing.
You would set the values separately as vectors.
Explicit update of each stucture's compoment would help.
It consist of float4 values and one simple float.
Everything would be passed to the shader.
Of course you need global variables in the effect.

P. S.
Everything or only needed parameters smile.png

You would ask the question here also:
http://forums.create.msdn.com/forums/default.aspx?GroupID=7

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!