hshutao's picture

Draw Polygon with hole

i want to draw polygon with hole and pattern it with bitmap. how to do?
thanks.
hshutao.

[Moderator: fixed title spelling]


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
snocrash's picture

You will need to draw multiple polygons, a poly cant have a hole. applying a texture is really simple in OpenGL. I recomend reading the Red book to learn openGL.

http://www.glprogramming.com/red/

Good luck!

snocrash's picture

Also, there is also an example in OpenTK

in the directory - Source\Examples\Tutorial\Textures.cs

hshutao's picture

thank for your reply.

Dinberg's picture

I'm new and having a look round :D

I was just wondering, does OpenTK support alpha blended/alpha channel textures? If so, it could work nicely to have the polygon as a simple square, and texture it with the bitmap and give the alpha channel a nice nifty hole in the middle so that on rendering it goes straight through the polygon.

the Fiddler's picture

That's another good approach with good performance characteristics.

Fallout 3 used an even more complicated approach to simulate errosion in concrete slabs, rocks and similar rubble. I can't find the link now, but IIRC they used a pixel shader and alpha tests / texkill to discard fragments from the corners of the geometry. Relatively simple, but with great results.

In any case, OpenTK provides access to the whole OpenGL API (shaders, FBOs, everything). If there's something you can do with OpenGL, you'll be able to do it through OpenTK.

Dinberg's picture

Sounds very nice, thanks!