Resource Lookup with Custum HashTable

When working on my OpenGL tech demo, i needed to look up resources that were loaded, sources such as models, shaders or cube maps. I did this using std::map. When starting to work on my games fleadh game from scratch again i wanted to change how i did resource look up. I decided to roll my own hash table along with create my own hash function  using fvn-1a.

Continue reading “Resource Lookup with Custum HashTable”

Posted in C++

Determinant Predicates

When re-reading Real-Time Collision Detection by Christer Ericson i came across a section called Determinant Predicates in Chapter 3 A Math and Geometry Primer. I thought it was interesting that from just filling a matrix with data such a points in space and finding the determinate of that matrix you could do geometrical tests. Although the tests are not the most efficient ways for solving the problems outlined here i just wanted to make an implementation in C++ to test it myself.

Continue reading “Determinant Predicates”

Bitwise Operators

In this blog i will talk about some bitwise operators and their uses in programming. Operators such as: << , >> , | , & , ^ , ~ will be discussed.

The bitwise left shift operator <<

The bitwise shift operators works by shifting a number by a number of bits. For example if you shift the int value of 5 by the number of bits 2 in binary form, so 0100 now becomes 10100. We essential shifted the binary number 0100 by two bits. An interesting application for this is

Continue reading “Bitwise Operators”

Posted in C++

Virtual Functions & Virtual Tables.

We all know what virtual functions are and how to use them but it’s also important to know how they are implemented under the hood. Lets first take a look a non-virtual functions. They are easy because a particular function call always maps to a particular part of the code. The compiler can calculate the address of that function at compile and link time. At runtime all it does is make a call to a fixed address.

Continue reading “Virtual Functions & Virtual Tables.”

Posted in C++