Quaternions: what and why?

To fully understand about Quaternions, you should first understand what Complex Numbers are. I'll explain what a Quaternion is in a general matter first, and then explain it's basics.

What is it?

A Quaternion represents a rotation of a point in 3D space around an axis. That's it.

The name Quaternion has it's name because it's formed by 4 values (quadruple). Don't worry why it uses 4 values now. Just know that each of the values need to be build using sin/cos to actually means anything.

If you have a point in space, and you want to rotate it around any axis, you can use a Quaternion to do so. You can use other techniques, if you want too. Quaternions are just another option. Depending on your problem, it might better suit your solution.


read more...

OpenGL deprecated newbie functions =(

A few days ago a decided to develop a game as an excuse to improve my C++ skills, learn more how to use a Makefile and play with 3D graphics. As I'm on a Mac, I choose to use OpenGL 4.1. I had a litle bit of experience on OpengGL 3.1, but since OpenGL 3.3, a lot of things changed. Now, it requires a lot more core to have a simple 3D element on the screen (like VAO, VBO, shaders).

Now, in OpenGL 4.1, there's no more default shaders, so for now on, you need to load your own vertex and fragment shader. Also, there's no more glTranslate, glPushMatrix. All vectors manipulation (translate, rotate and scale) now needs to be done by your shader. This took me to had to back and refresh my memory (and study) and few mathematics stuff before going back to the code.


read more...

Counting files within folder (sub-folder). Shell or Ruby?

I was trying to count how many .java I had in one specific project. At first I tried using shell commands to do it but I find that I could do a easier task with Ruby.

Dir["/Users/celsodantas/code/java/src/**/*.java"].count

There we go. It will go through all sub-folders and return an array of all files. For me it's easier to remember this then a command shell command like:

find . -type f | wc -l

Some people might find easier to go with shell. I'm lazy and tend to go with what I remember more quickly. Feel free to chose what you feel more comfortable.

cheers!

First Post

Ok. Now I have a blog. I was wondering a long time to create a full blog to myself. Now what? Now I'll post stuff I've been searching, studding and learning. The idea here is to share stuff with the Internet and help others.


read more...