-
November 24th, 2010, 08:37 AM
#1
[RESOLVED] [2008] How to texture a triangle (2D)
Hello,
Currently working on a 2D engine, not for gaming but for design software / visualisation for machines. So far it is comming along quite fine. I started to wonder if it were possible to draw a triangle and fill it with some form of a a texture, or even better a polygon and fill that with a texture.
I know that DX can do that for me :P but I am realy focussing on GDI+ at the moment.
Anyone got any experiance with this and can tell me how to achieve this?
-
November 24th, 2010, 09:08 AM
#2
Re: [2008] How to texture a triangle (2D)
Unfortunatly almost directly after I posted this message and went back to VS I accedently found the texturebrush and after a quick test I found that that was also the answer to the question. For completeness I'll post a example of a textured Polygon:
Code:
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
MyBase.OnPaint(e)
Dim myBrush As New Drawing.TextureBrush(My.Resources.TestTexture, Drawing2D.WrapMode.Tile)
Dim myBox As Point() = New Point() {New Point(0, 0), New Point(300, 0), New Point(300, 300)}
e.Graphics.FillPolygon(myBrush, myBox)
End Sub
Easy as pie.
I am still amazed how complete GDI+ is, it is almost Direct3D :P.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|