Sign in to follow this  
usman1266

Primitives Color Problem

Recommended Posts

I have problem in color of primitives along with mesh program.My program have already mesh load and i draw a plane on button click but the color of plane not change which are given in CUSTOMVERTEX Vertices[] = { {-1.0f, -1.0f, 0.0f,D3DCOLOR_XRGB(0, 0, 255)}, {1.0f, -1.0f, 0.0f,D3DCOLOR_XRGB(0, 250, 55)}, {1.0f, -8.0f, 0.0f,D3DCOLOR_XRGB(250, 0, 5)}, {-1.0f,-8.0f, 0.0f,D3DCOLOR_XRGB(0, 0, 255)} }; I aslo change in SetRenderState function but not effect tell me what code missing.Help me some code example Thanks in Advance

Share this post


Link to post
Share on other sites
Is the color always showing up as dark red, by chance? I had that problem a while back and it had to do with the fact, that my vertex used a D3DXCOLOR, which is 4 floats, but I was using the D3DCOLOR_ARGB macro, which packs the color components into a single DWORD, and is intended for use with D3DCOLOR, not D3DXCOLOR.

I'm probably wrong, but I wanted to take a stab in the dark in case you are having the same problem I had.

Share this post


Link to post
Share on other sites
Quote:
Original post by usman1266
I have problem in color of primitives along with mesh program.My program have already mesh load and i draw a plane on button click but the color of plane not change which are given in

CUSTOMVERTEX Vertices[] =
{

{-1.0f, -1.0f, 0.0f,D3DCOLOR_XRGB(0, 0, 255)},
{1.0f, -1.0f, 0.0f,D3DCOLOR_XRGB(0, 250, 55)},
{1.0f, -8.0f, 0.0f,D3DCOLOR_XRGB(250, 0, 5)},
{-1.0f,-8.0f, 0.0f,D3DCOLOR_XRGB(0, 0, 255)}

};

I aslo change in SetRenderState function but not effect tell me what code missing.Help me some code example
Thanks in Advance
Can we see your code for changing the vertex colour? And what do you mean the plane doesn't change colour? If it's drawn on button click, what colour should it change from and to?

Share this post


Link to post
Share on other sites
Any (triangle,Plane etc)Primivites I draw on screen its give one color and not shows that color mention in code.Can I miss any code or any new values in SetRenderState
Please give me code,I am using same code downloaded from different open source project but its not work

Share this post


Link to post
Share on other sites
Quote:
Original post by usman1266
what i do help me please send me which portion of code i add,send me code example
thanks advance
You just disable lighting before rendering the plane, and then re-enable it before drawing the mesh.

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