This project has moved and is read-only. For the latest updates, please go here.

Textures change primitives' color

Feb 5, 2015 at 3:10 PM
Edited Feb 5, 2015 at 3:11 PM
Hi! I am implementing Box2D's debug draw functions on my 2D game using DirectXTK's PrimitiveBatch. I can draw the primitives correctly, but for some reason the color of the primitives change according to the textures drawn on screen. For example, my character is red -> primitives are red. My character shoots yellow bullets -> primitives change color to yellow. I use spritebatch to draw the textures.

Any ideas how to fix this?
Feb 5, 2015 at 4:01 PM
What shader are you using to draw the primitives, and how do you configure this?
Feb 5, 2015 at 8:19 PM
ShawnHargreaves wrote:
What shader are you using to draw the primitives, and how do you configure this?
Awesome, I got it working. Thanks for pushing me to the right direction, since I haven't fiddled with rendering before.

I didn't realize that PrimitiveBatch doesn't initialize shaders as SpriteBatch does, noticed this by getting the app crash by disabling the spriteBatch rendering. So the fix was to configure the vertex shader.
Marked as answer by walbourn on 2/5/2015 at 12:22 PM
Feb 5, 2015 at 8:22 PM
Glad you fixed it. The usage should be covered in the wiki and I have a tutorial as well.