# (Hopefully trivial question) How do you make a red linelist show on a black bg?

This topic is 4776 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

So I have this wonderfully nice black texture, and am trying to contruct a rectangle (which is red) and have the rectangle show on top of it. However I can never see the color of the rectangle. Should I put it on a white/gray striped background I can see the red color nicely, however I cannot see the red rectangles when I use a black background. I setup my rectangle in a vertexbuffer and draw it as a primitive(linestrip):
hr = _device->SetStreamSource(0, vtx, 0, sizeof(CUSTOMVERTEX));
hr = _device->SetFVF(D3DFVF_CUSTOMVERTEX);
hr = _device->DrawPrimitive( D3DPT_LINESTRIP, 0, 4);

The vertices are setup using D3DFVF_CUSTOMVERTEX=D3DFVF_XYZRHW|D3DFVF_DIFFUSE, and have the form of ( x, y, 0.0f(z), 1.0f(rhw), 0xffff0000 ). The background texture is black, setup as D3DFVF_XYZRHW|D3DFVF_TEX2, and have the form, ( x, y, 0.0f(z), 1.0f(rhw), tu, tv, tu1, tv1 ). Any ideas why the rectangles will not render on top of the black as red colored boxes?

##### Share on other sites
The only thing I can suggest is trying to set your texture's z to 1.0f or something similiar (just so that they're not both on the 0.0f z-plane.)

##### Share on other sites
How did you setup your customvertex? Is the size correct? Where in the render process did you place this code?

##### Share on other sites
Programmer 16: Yeah I changed z coords, no luck unfortunately :(

Marmin:
My render is as such:

I clear, then render the texture.

Then I render the rectangles and set the FVF, so it comes at the end of the rendering loop.

I setup my customvertex to be of size 5( 0...4 ) so I have 5 line segments which forms a rectangle, which are in clockwise order as they should be. If thats not enough info please let me know.

##### Share on other sites
Try setting the texture stages to 0:
_device->SetTexture(0, 0);

(Set all of the ones that you use to 0)

##### Share on other sites
After I do a settexture and before I render my linelist? Or did you mean something else?

##### Share on other sites
After you render your texture, but before you render your rectangle. Otherwise I believe Direct3D will try rendering a texture over it (even if uv coordinates are 0.)

##### Share on other sites
Wow that seems to me odd behavior... but I could just be crazy :)

Anyway, thanks! That worked well (now hopefully will work equally as well on a NVidia card), but thanks for the tip!

1. 1
2. 2
Rutin
25
3. 3
4. 4
JoeJ
18
5. 5

• 14
• 22
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631764
• Total Posts
3002210
×