开发者

Simplest Way of drawing line, point, pixel?

I'm using SlimDX and C#.

Can you tell me how to draw a simple line and pixel using directx9? I don't want this line to be textured, 3d or shaded or affect by lighting.

I just want to 开发者_开发百科draw simple 2d solid colored line and pixel.


Just using dx9 makes these trivial tasks difficult. It was not built to do these kind of 2D operations. Of course there are ways to do it. Like creating a VertexBuffer with your point or line data, and rendering it as LineList or PointList. But the overhead just for doing this is a lot. Microsoft understood these kind of limitation so they brought back the idea of DirectDraw (which wasn't easy to use for these task aswell)in the form of Direct2D it is exactly for these kind of things BUT, and this maybe makes it useless for you, it only works on Vista and Windows7. If not, i would definitly use Direct2D for that, which is also wrapped in SlimDX.

If this is not an option, you have to decide if you need DX9 after all and maybe switch to GDI or bite the bullet and take the hard way of using D3D9 for that. One hint i know is, that SlimDX has a Line class in SlimDX.Direct3D9.Line which might help you a bit.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜