2D Lines and filled rects in Direct3D

Started by
3 comments, last by SikCiv 22 years, 6 months ago
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

  Downloads:  ZeroOne Realm

Advertisement
look at the sdk docs for:
D3DPT_LINESTRIP
D3DPT_LINELIST
D3DPT_POINT
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
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

  Downloads:  ZeroOne Realm

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

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.
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials

This topic is closed to new replies.

Advertisement