Muhammad Omer
Muhammad Omer

Reputation: 553

Checking collision between two glutSolidCube objects

I am implementing a small blocks stacking game in opengl with c++. I have to use glutSolidCube objects of random sizes which will fall from the top of the screen towards a floor and if they collide with some other glutSolidCube object which is already on the floor, they will be stacked above the other object or else they will come to rest when they hit the floor. I cant find any possibility to check when one glutSolidCube object collides with the other, does anyone have any idea how this could be done?

Upvotes: 3

Views: 432

Answers (1)

genpfault
genpfault

Reputation: 52084

OpenGL is just a fancy triangle rasterizer. glutSolidCube() draws some triangles that happen to look like a cube. There are no "objects" to test for collision, just pixels in a framebuffer.

You'll have to implement your own collision detection system independent of OpenGL.

Or use something off the shelf.

Upvotes: 1

Related Questions