Sunday 20 May 2007

Computer Graphics Lab 2 : Fly text

This flying text animation was done in opengl. It was an assignment given to us during my computer graphics module and we had quite alot of fun with it. Our lecturer wanted to give us some freedom to express our creativity but was also surprised at what all the students came up with. For my assignment, I chose not to use any pictures and went for the ascii art theme, using only text in opengl. I think he was particularly pleased with the fireworks explosion of '@' symbols.

Everything you see in this video was programed by me. I used abit of procedural animation (the ball and the firework particles). If you're wondering what procedural animation is, it is animation which is done by program code or math unlike the normal animation where everything is placed manually via some editor and the positions are recorded and played back.

The scenes were done with a simple switch case statement with a timer clock to determine the start and end of each scene.

The colour changes were done by interpolating the color using the same clock by a mathematical formula.

here's the code snippet for drawing the ascii faces:


and here's the final product:



after-blog note: wow this post caused me more trouble than i expected. I found that the flvplayer component provided by flash could not load the skin for the buttons. ok let me explain. This blogger site does not allow me to host swf files so I am uploading my files to another server and linking to there. However, I found that the flv (flash video) could play but the skin could not load resulting in the entire playback button panel not showing up. So I added some code and found that the player for spitting out a skinError saying it is unable to load the file. After googling for some time, I finally found this (really hard to find) page from adobe.
But i did not like their solution because that brings me back to the problem of how to upload swfs to blogger. So what i did was instead use iframes. A quick guide by w3schools here.
And voila! it worked. Only bad thing about iframes is that if you size it exactly to the swf, the scrollbars may show up. So you may have to use trial and error to get the iframe size right. Here's and example of the iframe code I am using (i added back slashes to get the browsers to show the text instead on try to parse it as html code) :

\< src="http://yoursite.com/yourswf.html" align="middle" frameborder="0" height="270" width="420">

No comments:

Get Adsense

Want to earn money like me? Get Google Adsense now by clicking this