Sign in to follow this  
thrawn42

Vertex Coloring issue ....

Recommended Posts

Sorry for the slightly similar post, but after looking around for awhile I can't seem to figure out just what is going on with my code. I'm coding the rendering portion of a project I am working on at the moment. I seem to be having some trouble with coloring a triangle using its vertices. I'm drawing a pyramid to the screen at the moment and during debugging all of the vertice data I'm using seems to be correct (3 FLOAT and a D3DCOLOR). I've been concentrating on the various flags being set before my DrawPrimitive() call on the vertex buffer. Here's my FVF: D3DFVF_XYZ | D3DFVF_DIFFUSE With diffuse in my FVF the entire screen is black. With specular on the pyramid is rendered completely (I know because I'm rotating it) however each triangle color bears no reflection to its vertices' color. Each triangle face should have a different color. As it is they're all white. I've made sure the following is set just before DrawPrimitive(): d3d_device->SetRenderState(D3DRS_COLORVERTEX, TRUE); d3d_device->SetRenderState(D3DRS_DIFFUSEMATERIALSOURCE, D3DMCS_COLOR1); d3d_device->SetRenderState(D3DRS_LIGHTING, FALSE); Seems to me it should be taking the diffuse color as defined in the vertices. I'm scratching my head here. Can someone help?

Share this post


Link to post
Share on other sites
Ok...one of those problems that resolve itself right when you finally resort to posting on a forum about it. For some reason I was using the D3DCOLOR_RGBA macro with 1's instead of 255's (for basic colors).

But now half of my triangles went black! Weird. Now to figure this next dilemma out.

Share this post


Link to post
Share on other sites
Kickass! Done and done. I solved my problem and hopefully without bothering the fine denizens of this board at all. Now for a mod to close this thread.

Again sorry about the post. I really was working on this problem for some time before I came here for help.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this