Jump to content
  • Advertisement
Sign in to follow this  
Alex Red

Can SetMaterial() be interleaved with rendering...?

This topic is 4840 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

Hi guys... I am modifing up a DX7 engine I am trying so assign different surfaces 'features' with the D3DMATERIAL7 material and the call SetMaterial()... Well...seems only the 1st SetMaterial() call seems to be accepted, the others seem to be ignored... The calls are done in btw DrawIndexedPrimitiveVB() calls... Then, the doubt, is the SetMaterial() call interleavable with draws...? Should I flush Buffers or check/wait for smthing before calling it again...? tnx for any info [R]ed

Share this post


Link to post
Share on other sites
Advertisement
Hi there Alex Red,

[The Problem]
can SetMaterial() calls be interleaved?

[The Solution]
You certainly may.
Note a few things. (Sorry if this seems a little condescending, it is not my intention)

Scenario 1 (blue Material will never be applied to the primitives)
[Render Loop]
1) SetMaterial(redMaterial)
2) DrawPrimitive()
3) SetMaterial(blueMaterial)
4) Goto step 1

Scenario 2 (blue Material will only be applied to the second batch of primitives)
[Render Loop]
1) SetMaterial(redMaterial)
2) DrawPrimitive()
3) SetMaterial(blueMaterial)
4) DrawPrimitive()
5) Goto step 1

Check check if you are specifying the SetMaterials in the correct order such as.

[Render Loop]
1) SetMaterial(redMaterial)
2) DrawPrimitive() //render the primitives with a red material
3) SetMaterial(blueMaterial)
4) DrawPrimitive() //render the primitives with a blue material
5) Goto step 1

PS: also make sure you aren't setting the same material twice. It is a common mistake and might cause severe headaches :)

such as
[Render Loop]
1) SetMaterial(redMaterial)
2) DrawPrimitive() //render the primitives with a red material
3) SetMaterial(redMaterial) //Note the RED MATERIAL :)
4) DrawPrimitive() //render the primitives with a blue material
5) Goto step 1


I hope this helps buddy. Take care.

Share this post


Link to post
Share on other sites
yep...
but... u want to say I can not apply the same D3DMATERIAL7 object twice consecutively...?
There is no such indication on docs... I thought the SetMaterial() just passes an Address Reference from which DX will clonate settings...and so...no matters about same address...
ok...
I will check

Tnx...

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!