Saturday, July 28, 2007

Roadtrip - a photoblog

Wing rider(s). Disclaimer: The riding depicted in the above pic has been performed by untrained amateurs. Please do try and imitate them on the roads. Always wear your helmet(so that you are are not recognizable)


paarapurathe thavalakuttikalude jeevithathilekku oru ethinottam


ASB - Oru chalikkunna kurishu


Motion Blur


Enroute to the watch tower


Finally there!!

Vishakkunnello vishakkunnello..bhakshanam thaayo, bhakshanam thaayoo!!


Sreedish thinking whether he should personally verify the laws of gravity


Simply AWWSUMM!


Kaadum kaattaruvikalum


The long lost sacred art of climbing up a stream

Apocalypto


Full body cast'il aavathe thirichethiyathinte aashwaasam


"Innekku durgashtami!! Unne njaan konnu unn rakhthathe kudichiduve!!"


Sreejith, 2 seconds after someone mentioned the word "aana"


Remnants of an old empire


The "mean" machines


And miles to go before we sleep..........................




Friday, July 27, 2007

Graphics.h in GNU/Linux


Ive read and pondered upon lots of blogs and posts regarding the topics "20xx is the year of the linux desktop" , "linux is not yet ready for the desktop" etc etc.I guess the answer to all such questions is personal in nature. I mean id say "try and find out". I started using a GNU/Linux distribution about 8 months ago. Since then my aim was to do whatever stuff i was doing on XP, on GNU/Linux and maybe find stuff i couldnt do on XP. Thats how i approached/read about GNU/Linux though i later found out that, that approach isn't exactly right, as i was merely "reducing" GNU/Linux to a windows replacement, while its actually a whole another approach to computing.
Anyways, since i joined engineering if there was one thing i didnt like at all, then it was the "Blue Screen Of Death" or the Turbo C interface. Since s3 i never used Turbo C at home. I've always preferred Visual Studio or Dev C++ over Turbo C. I just didnt like the interface. This dislike of turbo C didnt however hamper my coding functionalities in other IDE's as they always had what i wanted. After moving to GNU/Linux i was able to do the same programs and compile them using G++. But s7 is were the problem starts. Now i gotta "computer graphics" lab which makes extensive use of the "graphics.h" library. I had heard rumours earlier that it wasnt available in all IDE's and to my dismay i found out that it wasnt there in GNU/Linux either. Another problem was that since the functions it included involved direct access to the hardware merely copying the graphics.h header to the library folders wouldnt help. As always google helped. Stumbled upon the blog of a person who was in the same situation as I am and he had found a solution. The answer to my problem was a set of libraries called libgraph which wraps around the SDL API.
His blog did contain steps to install in debian but it didnt work for me coz of minor hiccups. SO i spent sometime and finally succeeded in getting it to work on my ubuntu feisty install. I just thought i'd post it here so that google drops this in front of another seeker :)

Step 1: Installing dependencies

run sudo apt-get install build-essential to make sure you have installed all necessary compiler tools

Now comes the real achy part. Open synaptic and install the following packages

libsdl-image1.2
libsdl-image1.2-dev
guile-1.8
guile-1.8-dev
libsdl1.2debian-arts
libartsc0-dev
libaudiofile-dev
libesd0-dev
libdirectfb-dev
libdirectfb-extra
libfreetype6-dev
libxext-dev
x11proto-xext-dev
libfreetype6(upgrade)
libaa1
libaa1-dev
libslang2-dev
libasound2
libasound-dev

You can install them in a single go by adding all the above package names(separated by a black space) to the end of sudo apt-get install Even if it asks you to uninstall some already installed stuff, tell it to proceed. After all this is over. Download this file onto your home folder: libgraph-1.0.1

Right click on the file u just downloaded and click "Extract here"

open terminal and navigate into the folder u just extracted the file contents into by running cd libgraph-1.0.1

Now run the following commands one after the another. Proceed to the next command only if the preceding command executes without any errors.
./configure

sudo make
make install

If you get any errors during the "sudo make" step, paste it in the comments section of this post.

Now technically install is over. Try writing a simple program including graphics.h. Declare the values of gd and gm and call initgraph as follows

int gd,gm=VGAMAX; gd=DETECT; initgraph(&gd,&gm,NULL);

and when compiling using g++ add an extra paramter -lgraph

i.e if you are compiling a program dda.cpp in the terminal u type in

g++ dda.cpp -o dda.o -lgraph

And execute the program by runnung ./dda.o

If on compile it gives u an error that says "could not load shared libraries" or something like that just run the following command and it should fix it

sudo cp /usr/local/lib/libgraph.* /usr/lib

I also read somewhere that graphics.h dosen't have ANY practical use in today's world and that its only "use" now is to help students learn to apply different algorithm's they have to study in a paper called "Computer Graphics"


May the source be with you :)