Primitives Color Problem

Started by
9 comments, last by usman1266 15 years, 3 months ago
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
Advertisement
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.
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?
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
What color is it displaying?
Have you disabled the lighting?
THANKS THANKS THANKS

problem in ligthing code .
But one more problem occur in mesh,Mesh color show dark white.

Primivities colors are shown but mesh shows in white color
If you disable the lighting, the mesh color will be white.
This is because of the material /lighting system.
what i do help me please send me which portion of code i add,send me code example
thanks advance
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.

This topic is closed to new replies.

Advertisement