Thursday, 4 October 2012

Graphics Programming - Sierpinski Gasket's

One of my modules at university this trimester is introduction to graphics programming where we are working on building up a graphics rendering framework using GLFW.

After each section of practicals we have been given a challenge to create a sierpinski gasket.
(Wikipedia link for those interested - http://en.wikipedia.org/wiki/Sierpinski_triangle)

My first challenge was to create a point based sierpinski gasket.
Point based sierpinski gasket
This wasn't too tricky to do it mostly it was just a case of converting the following algorithm into code.

After learning how to create vertex arrays to draw triangles, the next challenge was to create a sierpinski gasket using triangle sub divisions.
2D sierpinski gasket
Once i figured out what midpoints and vertices i had to pass back into my divide triangle method this was fairly simple to get working.

Currently i am working on creating a 3d sierpinski gasket using tetrahedrons. This is proving to be a lot more tricky than i thought it would have been and i cant quite get the maths correct in my code.
Broken 3d sierpinski gasket
I am going to keep working on it and hopefully i can get it fixed in the next day or two and i will post an update when i can.

Email: 10004794@napier.ac.uk - Please put blog in the subject.
Xbox Gamertag: craigmcmillan01
Twitter: Follow @craigmcmillan01
steam: craigmcmillan01
add or follow and we can game!

No comments:

Post a Comment