Jump to content
  • Advertisement
Sign in to follow this  
Sigurd Lerstad

one diffuse color for entire primitive

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

Hello, I'm trying to draw primitives using a single diffuse color (not per-vertex color), with no lighting. I've tried different variations of the below. RenderState(D3DRS_LIGHTING, FALSE); RenderState(D3DRS_DIFFUSEMATERIALSOURCE, D3DMCS_MATERIAL); RenderState(D3DRS_COLORVERTEX, TRUE/FALSE); mat {diffuseColor} SetMaterial(mat); Draw( XYZ vertices...) But I have been unsuccessful so far, so I'd appreciate any help. thanks, -- Sigurd Lerstad

Share this post


Link to post
Share on other sites
Advertisement
Try looking into setting the D3DSHADEMODE render state to be D3DSHADE_FLAT.

There aren't any per-primitive attributes like this as everything in D3D is specified per-vertex. You can fake this by using flat shading that simply takes whatever value is in the first vertex and ignores the other 2 vertices. This will work for you provided you're careful about triangles sharing the same first vertex...

hth
Jack

Share this post


Link to post
Share on other sites
I haven't used the fixed function pipeline much, but from the docs I get the impression that materials are only used if lighting is enabled.
If you wanted to change an entire object's color then perhaps: enable lighting, set the ambient light to full white, and then set the ambient component of the material to whatever color you want the object to be.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!