Re: Drawing polygon
From: Fabian Schmied (REMOVETHISfabianDOTschmied_at_fhs-hagenbergDOTacDOTat)
Date: 05/13/04
- Next message: Markus: "Re: Drawing polygon"
- Previous message: dxrox: "Re: Vertex Buffer not Rendering"
- In reply to: maka3: "Drawing polygon"
- Next in thread: Markus: "Re: Drawing polygon"
- Reply: Markus: "Re: Drawing polygon"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 13 May 2004 15:56:52 +0200
maka3 schrieb:
> Hi,
> What's the best way to draw a polygon with 4 corners in directdraw?
> I only see a DrawBox or DrawRectangle function. I've tried this gdi
> approach but it slows down the app.
> IntPtr dc=surface.GetDc();
> Graphics g=Graphics.FromHdc(dc);
> g.DrawPolygon(...);
> surface.Release(dc);
This is a GDI+ approach. It might be faster to p/invoke the GDI
function Polyline, but it's still GDI and not DirectDraw. You can't use
DirectDraw to efficiently draw lines (although there is a DrawLine
method, but it uses GDI) unless you lock the surface and implement a
Bresenham line drawing algorithm or something yourself (which is
difficult in managed DirectX bacause of Lock bugs).
BTW: You need to dispose of the Graphics object before you release the DC.
Fabian
- Next message: Markus: "Re: Drawing polygon"
- Previous message: dxrox: "Re: Vertex Buffer not Rendering"
- In reply to: maka3: "Drawing polygon"
- Next in thread: Markus: "Re: Drawing polygon"
- Reply: Markus: "Re: Drawing polygon"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|