Please could you explain this code?

This is a discussion on Please could you explain this code? within the C++ Programming forums, part of the General Programming Boards category; Please could you explain the following code in detail as i am so baffled and i do not know what ...

Please could you explain this code?

Please could you explain the following code in detail as i am so baffled and i do not know what this code exactly does. This is a game that basically draws multiple 3d objects i don't understand how and where the drawings were achieved so could you please explain thank you in advance

Ok class object inherits from class GamesObject. That kind of makes sense now. So its quite diffcult to explain the whole code. I would appreciate if you point out which part of the code you dont understand. You will have to ask smart question rather than just asking anything.

It will take me ages to explain you that code. And i do not have that much time

like ssharish2005 said, there are many things going on in there. The short version is that object:: Draw() is the one that tell openGL how to "plot" your 3D object-- in this case, it's a solid cone since you're calling glutSolidCone(). OpenGL uses stacks of matrices to manage your object and how you view the object. since matrices are stored in stack, you need to push and pop them.

Ok class object inherits from class GamesObject. That kind of makes sense now. So its quite diffcult to explain the whole code. I would appreciate if you point out which part of the code you dont understand. You will have to ask smart question rather than just asking anything.

It will take me ages to explain you that code. And i do not have that much time

ssharish

Thank you for the response,

Could you please explain how the 3d object was drawn, and translated into positioned?

for that particulate code check out: glutSolidCone
OpenGL can draw different object as well.

Thank you for that,

but could you briefly explain how would one figure out the base , height , slices , stacks of glutSolidCone, would it be possible to initially draw it on a graph paper? or how would would initially figure it out before actually translating it into code? and could you also briefly explain how the colouring of that object was achieved, thank you so much for you help