matrix stacks

Started by
-1 comments, last by gumball 23 years, 11 months ago
Hi, I am moving from retained mode to immediate mode and need some guidance with matrix stacks Currently in Retained mode I create a scene heirarchy as follows: CreateSceneHeirarchy.... Scene (Root) * *--- Sun (Child of Scene) * *--- EarthOrbit (Child of Scene) .........* .........*--- Earth (Child of EarthOrbit) .........* .........*--- MoonOrbit (Child of EarthOrbit) .................* .................*--- Moon (Child of MoonOrbit) Note the Orbit frames are only used as containers so that I can rotate the planets on their own axis whilst they (actually the orbit and therefore the planet) rotates around the sun I then set up various positions and rotations using the following: BuildScene... Sun->SetPosition(Scene,0,0,0) // Set position relative to scene Sun->SetRotation(Scene,0,-1,0,rotamt1) // Set Sun rotating on own Y axis EarthOrbit->SetPosition(Sun,0,0,0) // Set position relative to scene EarthOrbit->SetRotation(Sun,0,1,0,rotamt2) // Set EarthOrbit rotating around sun Earth->SetPosition(EarthOrbit,8,0,18) // Set pos of Earth relative to EarthOrbit Earth->SetRotation(Scene,0,-1,0,rotamt3) // Set earth rotating on own Y axis MoonOrbit->SetPosition(Earth,0,0,0) // Set position relative to Earth MoonOrbit->SetRotation(Earth,0,1,0,rotamt4) // Set moonorbit rotating around earth Moon->SetPosition(MoonOrbit,3,0,0) // Set pos of moon relative to moonorbit Moon->SetRotation(Scene,0,1,0,rotamt5) // Set moon rotating on own Y axis How do I use a matrix stack to do the same sort of thing in Immediate Mode? Edited by - gumball on 5/6/00 2:14:22 AM Edited by - gumball on 5/6/00 2:15:55 AM

This topic is closed to new replies.

Advertisement