Jump to content
  • Advertisement
Sign in to follow this  
dpro

(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.

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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 this post


Link to post
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 this post


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

Share this post


Link to post
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 this post


Link to post
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!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!