Archived

This topic is now archived and is closed to further replies.

SikCiv

2D Lines and filled rects in Direct3D

Recommended Posts

SikCiv    122
I am using D3DXSprite to blit 2D sprites, though I need to be able to blit single pixel lines and rects as like in DirectDraw using the rectangle() and lintto(). Is this possible? Or would I need to blit the lines with textures? Pls supply the code if possible. Thankx in advance.

  Downloads:  ZeroOne Realm

Share this post


Link to post
Share on other sites
SikCiv    122
Thanks ill look into it, in the mean time are there any tutorials covering this topic?

Edited by - SikCiv on October 18, 2001 12:30:20 AM

Share this post


Link to post
Share on other sites
acraig    471
For filled rectangles you can always "cheat" and use the IDirect3DDevice8::Clear function and pass in the RECT you want to draw.

This method isn''t the geatest since it doesn''t support the alpha colour and your out of luck if you want to do any transformations on it.



-------
Andrew

Share this post


Link to post
Share on other sites
CrazedGenius    156
There are some tutorials on FlipCode, but basically create a bunch of vertices, draw them as a line strip and voila, connected lines. Works exactly the same as triangles.

The only problem is that DX does not have the notion of line width (OpenGL rules, man!) so you have to get clever if you want thick lines. I do it by jittering the line and redrawing it several times, others draw very thin rectangles.

Share this post


Link to post
Share on other sites