//X = starting position X //Y = starting position Y //W = Width of the rectangle //H = Height of the rectangle rec1;//x y w h rec2;//x y w h //The way we gonna check collision is //From left //From right //From top //From bottom if(rec1.x + rec1.w > rec2.x && rec1.x < rec2.x + rec2.w && rec1.y + rec1.h > rec2.y && rec1.y < rec2.y + rec2.w )
EDIT::
I have noticed there is a tag for OpenGL? your checking collision in 3D?