   Direct3d 9 removing materials and textures
  In Direct3d 9, after you set a material or a texture and you draw what you need to, how do you remove the materials and textures so that you can draw something simple like line primitives?  Since there is a SetMaterial function, is there a similar method for removing the material?   
  Just use NULL for the material and texture you set in the device.E.g., dev->SetMaterial(NULL);;Quote:Original post by BuckeyeJust use NULL for the material and texture you set in the device.E.g., dev->SetMaterial(NULL);That worked for the texture. For the material it gave an unhandled exception.Any ideas how to handle this? It seems pointless to create a new material just to draw my line primitive. Would it be better to just turn lighting off when drawing the lines and then turn it back on after?On a side note, this makes me wonder when and where I should be resetting materials and textures after they have been used.  Any thoughts? It seems like it could be redundant or useless most of the time, but could cause issues like I am having if not taken care of.;Quote:For the material it gave an unhandled exception.Oops. Sorry about that. [embarrass]Quote:It seems pointless to create a new material just to draw my line primitive. Would it be better to just turn lighting off when drawing the lines and then turn it back on after?You can certainly do that. I wouldn't say it's better, if it doesn't do what you want it to. Why do you say its pointless to create a material to draw your lines? You only have to create it once.Quote:when and where I should be resetting materials and textures after they have been used ... It seems like it could be redundant or useless most of the timeCan you explain a little more about what your concern is? Are you concerned about performance? You should set materials and texures whenever you need to, to render what you want to see. If the material or texture doesn't need to be changed, or it's "useless" (don't know what that means).. don't change it.   ;  isnt there a Release -> member?   ;Quote:Why do you say its pointless to create a material to draw your lines? You only have to create it once.But if I have 10 different color lines to draw then I would have to make 10 materials, but they would all be unnecessary if I could just set the material to null or do something similar.