Beyond My Mind

April 22, 2006

A C++ Color class for using with opengl

Filed under: Uncategorized — mahbub @ 9:05 pm

I know this is nothing new. But when I was looking for something similar to C# color class with tons of predefined color values I found one wihich somehow matches with my requirement but that was for MFC. So I took the predefined color codes from that class and added some function for my own purpose. Code project have two of them hosted there. Here are the links:

http://www.codeproject.com/gdi/ccolor.asp

http://www.codeproject.com/bitmap/ccolor.asp

I will not paste the entire file here, just a portion. The files can be downloaded from here. Let me discuss some of the characterstic of the class

The entire class is inside Mahbub namespace. The Color class has four color components for red, green, blue and alpha. It has a option to store a name for it as well. But the memory is never allocated if no name is specified. You can use random number generator and generate random color from it. I used Mersenne Twister random number generator with it. Also I used a Mathematics wrapper class with it. I will post the Mathematics wrapper class description later. You can download it from here or just replace with appropriate function from math.h.

Here is an example usage of it:

Color a = Color::RED;

glColor(a);

If you find it useful or have any suggestion please don’t forget to let me know, udvranto (a) yahoo.

Powered by Qumana

April 20, 2006

Programming language: language or translator?

Filed under: Uncategorized — mahbub @ 2:24 pm

This view towards the language came to my mind today while I was attending a rather boring class on an interesting topic. I had to spend last two days doing C++ coding and was thinking about it in the class. What is programming language?

When you write something in assembly language what happens? The compiler translates it into machine code and its excuted in the machine. The same notion is applied everywhere. So essentially every compiler is a translator, a mapping between two sets of instruction. I think YACC and other parser tool came out of this concept. Gotta read something on these.

December 25, 2005

First day at Staten Island, NY

Filed under: Uncategorized — mahbub @ 10:02 pm

We spent the whole day on plane journey. We reached La Guardia, NY in local time 8pm. It was raining. On our way to Tushi’s uncles home, I found the NY city a lot like Dhaka, densly packed city with dull appearance. It will be raining tomorrow also. Lets see where we can go.

December 24, 2005

Leaving for NY

Filed under: Uncategorized — mahbub @ 11:44 pm

For holiday we are leaving for NY. I am almost ready to go. Tushi is still preapring. I hope that this tour will be a nice one. My “to-do” list includes Visting The Statue of Liberty, Enjoying the new year party at Time Square, Enjoying the Christmass, Roam around the NY.

Hope to have a nice time.

First Post

Filed under: Uncategorized — mahbub @ 9:05 pm

I was searching for a good place to start a fresh new blog. Found the cool “performancing” extension for firefox and got the wordpress.com in its list. So giving it a go…

Blog at WordPress.com.