Jump to content

  • Log In with Google      Sign In   
  • Create Account

Why am I getting a wrong color with blend mode enabled?


Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
2 replies to this topic

#1   Members   -  Reputation: 148

Like
0Likes
Like

Posted 25 March 2014 - 12:54 PM

Hi. I've been working on a simple line draw and I can't get the colors to work. I want to draw a red line. This is my result:

 

VZnl3.png

 

I have defined two vertices with the same color (red with an alpha of 255). As you can see source color is completely black. If I disable blend mode, I'd still get this result, but if I enable it and play with D3DRS_SRCBLEND and D3DRS_DESTBLEND, I can change the result, but it never gets to the point that I want which is a full red line.

 

My vertex format is as follows:

 

D3DFVF_XYZ | D3DFVF_DIFFUSE

 

Someone said that it might be from vertices normal vectors, but I don't have any lighting in my scene so it's not that. However, if I change D3DFVF_XYZ to D3DFVF_XYZRHW and pass value 1 for rhw, it'll draw the line with correct color, but that's not the format I want. I want to be able to apply geometry changes to my vertices and I know RHW does not receive any of that. And, I have a totally bright material and even if I set D3DMCS_COLOR1 for D3DRS_DIFFUSEMATERIALSOURCE, I'd still get the same result in the picture above.



#2   Members   -  Reputation: 286

Like
3Likes
Like

Posted 25 March 2014 - 04:07 PM

It sounds like your input layouts might not be correct. That its expecting a float4 for the position but you are only giving it a float 3 or the other way around, so the vert color is not looking at the correct memory.

 

Check your input format and how you have your vertices packed.



#3   Members   -  Reputation: 148

Like
0Likes
Like

Posted 25 March 2014 - 05:13 PM

Hey thanks. I don't know why I didn't think of that in the first place. I was setting a wrong offset in SetStreamSource(). Thanks again.






Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.




PARTNERS