Labels

Sunday, December 08, 2013

Introduction to Game Programming - Programming in OpenGL

This post is a remake of my previous post.
Introduction:
Through years of experience of asking Mr. Google and lurking the Internet non stop, I found out that a lot of people gave out their example of OpenGL coding for people to refer but when I look at most of it, this is what in my mind "damn bloody messy, who the heck will understand and able to read these codes?" so yeah, I come out with this coding standard of OpenGL. You may follow if you want to, or continue back your own comfortable coding style but for me, this standard is usable in most if not all kind of condition.

This program is done using Qt 4.7.3 with Visual Studio 2008. No drag and drop involved (not my style to use and drag and drop tools)
There is 2 folders in this 'rar' file, the source code and the compiled executable, I tested it using fresh installed Windows 7 and it works without any need of installing any Redistributable of Microsoft Visual C++

Mouse Left Drag, Mouse Right Drag and Mouse Left + Right Drag perform different kind of rotation, try it out.
Download from here:
Programming in OpenGL

Introduction to Game Programming - Concept of OpenGL

What is OpenGL?
You can read the description from Wikipedia, but as you noticed, Wikipedia's description are too confusing which most programmer/developers/game coders do not have the patient to read them.

What I'm attaching over here is some simplified, graphical representation of OpenGL, for you guys to understand how to use OpenGL for your own project or work.
Concept of OpenGL

Feel free to drop any comments or corrections and I will update them asap.

Sunday, June 16, 2013

Outer Space Adventure - Part 6 - Solving sudden encounter of extreme different temperature cloud of molecules

Okay ladies and gentlemen, today we are going to relearn about molecules and temperature. By the way, it's a nice picture right? I use this picture not of the precision of the molecule representation, but the beauty of it :P. Kudos to whoever that made this. Anyway, the pattern suit the molecular bonding also.

So, what is molecule?
Nothing new from me, same, a set of atoms bonded together.

So, what is temperature?
All physicist, scientist and researchers should already know this, but not everyone can learn about this with the current syllabus.
In normal term, we define something Hot or Cold when we feel it with our skin's receptor. Touch a boiling kettle, we shout "Hot!!", throw yourself naked in a bath tube full with ice cube, we shout "Cold!"
So, what is happening?
By the way, we also need to know that our skin's receptors constantly send the heat signal to our brain telling us about the surrounding heat.
So, now we know our body have body temperature that makes our skin molecule vibrate at a constant frequency. And the different electrical signals send different signals to our brain on different heat.
When we touch a boiling kettle, the energy of our vibrating skin molecules is being amplified into super vibration, causing extreme electrical charge towards our brain, and thus, we feel hot.
When we touch an ice cube, the energy of our vibrating skin molecules is being drained away, transferred to the ice cube, and our skin's heat receptor send less electrical charge to our brain, and after we get used to some constant electrical charge, getting less dose of that electrical charge makes our brain feel uncomfortable, and we feel cold.

So what I'm trying to tell you is, temperature is difference of vibrating energy of some molecule.

And yeah, if our spaceship simply go into these cloud of molecules, the ship's shield and plating will break due to sudden changes of frequency because of the molecular bonding unable to withhold the changes.

So, how do we use this knowledge to avoid breaking our ship when encountering these clouds?
Idea #1
Use heat detector technology already developed, avoid going into these clouds. Go around them.
(Not cool)

Idea #2
Use heat detector technology already developed, use some mega laser technology, currently being developed, pew pew them away.
(Cool, but would be a waste of energy I guess?)

Idea #3
Develop some magnetic shield around the ship, based on "Outer Space Adventure - Part 4 - Solving Cosmic Radiations Problem", to spin and prevent all incoming molecule from touching the spaceship's plating when we go through that cloud of molecule
(Super cool, 1 stone hit 2 birds I suppose?)

Suggestion, go for Idea #3 :)

Sunday, June 09, 2013

Outer Space Adventure - Part 5 - Solving Sudden Meteor showers and Space Debris Problem

So yeah, today, we are going to look into space rocks and debris problemo~
Lets just make a new term "Space Obstacles" for space rocks and debris since we are going to treat them the same out there. Evade or destroy.

Outside there, yeah there is countless twinkle twinkle bling bling stars out there but there is much more of these Space Obstacles floating out there and yep, if we are going to crash onto these things, no matter how many times we shout "Houston Houston~ bla bla bla" it's game over for us and we are going to be part of those Space Obstacles :D

Alright. Look at the picture above. This is the only picture I can get closest to describe this Space Obstacles. Look at the those rocks with the planet directly behind it, what we can see? Pitch Black.
So, what if the background is nothing? We see nothing, yeah, nothing, total darkness, like walking around blindfolded. That is outer space traveling. So how do we solve these problem?

Lets consider:
Idea #1: Attaching spotlights all around the spaceship, making the spaceship looks like a moving concert vessel and try to use camera to detect these Space Obstacles and Pew Pew them off with something.
Problem:
- Those spotlights bulb/LED/etc etc will expire, and need to be exchanged when it expires.
- Extensive Vision Inspection Algorithm will needed to be created to perform this live checking
- When we facing some extreme photon(light) source, lets say some other Sun out there at near range, the Space obstacle will be invisible due to photon(light) bending when passing through the space obstacle.
- The spaceship looks super lame

Idea #2: Using some EM(Photon) wave generator & receiver of some specific frequency (lower than visible light) and generate some pattern, when same pattern is being reflected, we can pinpoint the position of any nearby Space Obstacles and destroy them. Good idea
Problem:
- Will expire also at some point but can be replaced.
Risk:
- Possibility of extensive space EM(Photon) wave interference causing extensive noises.

Idea #3: Using Idea #2, we deploy more of these EM(Photon) wave generator & receiver of different frequencies to reduce the noise using results from all of them combined together to pinpoint location of these Space Obstacles.

I propose Idea #3 to solve this problem.

Sunday, June 02, 2013

Outer Space Adventure - Part 4 - Solving Cosmic Radiations Problem

Firstly, for those who does not know about this already, I would like to introduce that Electromagnetic Waves IS photons vibrating on different frequencies. (They should just rename the entire thing to "Photon Spectrum", since previously these stuffs are named as "Electromagnetic Spectrum" because they use electric to generate all these lights and waves and these stuffs generate magnetic field of its own and the light particle is yet to be discovered)

Secondly, for those who does not know how these photons works.
Case 1: Photons travelling through Glass
    - What happens here?
       1) When the photon goes near to the glass, it gets nearer and nearer to the glass on 1 side until it's pulled by the glass's molecule and bend towards another direction.
       2) During it's time in between the glass, there will be a lot of bending around but the direction does not change much because there are glass molecules all around neutralizing the attraction force. Of course there will be possibility of collision during the photon's travelling within the glass.
       3) When the photon leaving the glass, the side that it's leaning upon have more attraction force towards it and thus it will continue bend that photon back to it's original direction.
    - Why we still can see through glass like nothing all the time when there is possibility of collision between the photon and the molecules? Simple, because there are tons of them flying non stop. Notice that there is brightness/contrast difference when we see something through and without a glass.
    - We can see through glass because of the big glass's molecule gap. When the photon go through the glass, the direction it travel will be affected by the glass's molecules since there will be attraction force between 2 masses (Photon and glass's molecule), and when the nearer both of the mass is, the greater attraction force will be between them. (Some relativity theory)

Okay, what is cosmic radiation?
Cosmic radiations means photons, vibrating at frequencies higher than Visible Light flying around everywhere at space. The source of these photons are (I guess everyone knows already) those burning spheres like our sun out there.
The electromagnetic spectrum on top is just what Human discovered at the moment, possibility of much higher frequencies of these waves exists out there.

So yeah, why is these radiations are to be take note off?
Because, these stuffs can pierce into human cells and alter our DNA to become something else resulting mutated DNA and will cause cancers, diseases, birth defects, etc etc. Depending on their frequency, the Higher frequency/Shorter wavelength it is, the higher piercing power it has.

How do we stop these thing from piercing human body?
(For Space Suit)
Currently the space suit is manufactured using some reflective material. (Not that effective to block these cosmic radiation and looks lame thou... :P). I propose that we add external lead shield to these space suit.
(For Giant Space Craft)
Lead Shield + Reflective Shield + Generate Magnetic Field surrounding the space craft.

Sunday, May 26, 2013

Outer Space Adventure - Part 3 - Solving Gamma Ray Burst Problem


Gamma Ray Burst! (Cosmic Ray Gun) Sounds cool eh? Yeah and it's one of the thing we would like to avoid being hit at all cost :)
For detailed explanation and observation data, read it up at Wikipedia -> Gamma-ray burst

What creates Gamma Ray Burst?
Simple, Black Holes. Only these dead spheres has the gravitational force strong enough to charge and release an amount of Electromagnetic waves to whatever they are targeting.

How does this Gamma Ray Burst pop out? (Fully Theoretical, need proof)
If you read up my previous post Outer Space Adventure - Part 2 - Solving Black Hole Problem, How Black Hole is born?, you will understand how Black Hole works.
When a stabilized Black Hole swallow something else, the energy do not just simply and go and merge with the core of the Black Hole, For a Black Hole to be merged with something else to form a bigger Black Hole, It's either multiple Black Holes trying to swallow each other or it's eating something that has the same atomic properties with it's core, which I suppose, Iron (Fe) if I'm not mistaken (Saw this explanation some time ago which I totally forgot where this information I got it from :P) So what happens to those un-fused (leftovers) atoms? they are crunched and crunched into mixture of unknown mixture of energy together with all the Lights (Photons). When those Lights escape from the Black Hole Northern and Southern pole, it will create some path due to the extreme Inertia (from near 0 to speed of light) and then those bundled energy will escape through the path created by light I suppose, and Boom! Gamma Ray Burst :D

So how do we avoid these death rays?
First of all, there is no way to pin-point all the Black Holes out there man, no way and no point trying to figure out the location of the black holes except for the path we are going at.
From Mr. Wiki's information, I can see this line:
"with most of the explosion energy collimated into a narrow jet traveling at speeds exceeding 99.995% of the speed of light"
So yeah, we can detect sudden spike of Electromagnetic waves or Photons, whichever you wanna call it, and then run, at the direction Normal (90 Degree) from the axis of the electromagnetic waves as quickly as possible to avoid those incoming super intense and deadly energy :D

Sunday, May 19, 2013

Outer Space Adventure - Part 2 - Solving Black Hole Problem


Introduction:
What is Black Hole? (Reintroduced)
A chunk of mass so dense vs it's size to contain that amount of masses resulting it's gravity is so heavy that not even light (the fastest traveling particle discovered) can escape it and constantly sucking itself and whatever that gets near to it.

How Black Hole is born?
Basically a collapse of supersized chunk of constant fusion and fission reaction of atoms until the point where the final stage where fission rate is lower than fusion rate, and thus, the endless collapsing and expanding are out of balance where Rate of Shrinking (a.k.a Fusion) driven by gravity, is much greater than the Rate of Expansion (a.k.a Fission) and thus everything slowly pulling each other and in the end, when the rotation being stabilized, any extra energy that the black hole cannot hold on will be shoot out from the Northern and Southern point of it where it has the weakest gravity, due to lack of rotation at that point.

What happens during Big Bang? (Theory, need more confirmation)
Same thing, whatever is holding our universe right now is the largest supersized black hole, probably trillion times more of size compared to the one that holding our Milky Way together :)

So how do we avoid going head to head collision or getting trapped with these dead spheres?
The only sensible way I know so far is, by using Visual Image Processing to detect the light distortion from the background stars, if you get light distortion, that is our Red Alert.
Warning: DO NOT NAVIGATE TO SOMEWHERE WHERE WE CANNOT SEE ANY FIELDS OF STARS AT THE BACKGROUND

I never really tried looking and research into Cosmic Radiation Processing option to detect Black Holes since I do not have the data and tools to experiment with. NASA might want to look into this.