Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

nitro110

impementing my own glPush and PopMatrix?

This topic is 5392 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have an assignment where I have to write a program for my graphics class. We have to implement all our own functions, we cant use glRotate, glTranslate,..... I''ve got everything working, but am having trouble writing my glPush and Pop matrix. Any hints or help would be appreciated. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Keep a global linked list of matrices. Do this by writing an acyclic linked list class, then deriving a linked matrix class, adding the needed matrix functionality. When you Push, simply put the current matrix on the head of the linked list, and set the matrix stack pointer (which will be of type LinkedMatrix*) to the most recent addition. When you Pop, unlink the head of the list, and set the stack pointer to the former head''s Next pointer. If your design doesn''t allow you to just plug in a new matrix class, you can always just copy the data into the linked matrix object, then add this to the list, as long as you keep track of dynamic allocation.

Just ask if you need further clarification. I''m sure this isn''t the best way by far. There''s probably a boost or STL stack solution that would be neater for what you''re doing. It''s just the first thing that popped into my head, and it seems reasonable.

Later,
ZE.

//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!