# OpenGL Local/World transformations and openGL equivalents

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

## Recommended Posts

Hello... I have another question based on DirectX. In openGL, I can local transform an object based on its axes, or I can world transform an object based on the world axes. How would I go about doing so in DirectX? Also, what is the equivalent of glPushMatrix() and glPopMatrix() in DirectX? Thank you...

##### Share on other sites
Well I've been using Direct X for a while now and I'm 95% sure there simply isn't one. I ended up making my own. Wasn't so bad a process.

##### Share on other sites
That's tough... How, then, would I rotate 2 spheres, say 1 clockwise and the other counterclockwise, independant of each other?

##### Share on other sites
You must manage the matrices yourself. Roll your own matrix stack or use D3DX MatrixStack, then you'll have just the same push-pop-like semantics.

##### Share on other sites
Quote:
 Original post by ThunderSoulThat's tough... How, then, would I rotate 2 spheres, say 1 clockwise and the other counterclockwise, independant of each other?

Something like this would work for two objects rotating opposite directions.
static float index = 0.0f; index+=0.03f;    // an ever-increasing float valueD3DXMATRIX matRotateY;    // a matrix to store the rotation for each triangleD3DXMatrixRotationY(&matRotateY, index);    // the rotation matrixd3ddev->SetTransform(D3DTS_WORLD, &(matRotateY));    // set the world transform// Draw first sphere...static float index2 = 0.0f; index2-=0.03f;    // an ever-decreasing float valueD3DXMATRIX matMove;D3DXMatrixTranslation(&matMove, 10.0f, 0.0f, 0.0f); // x, y, z float valuesD3DXMatrixRotationY(&matRotateY, index2);     // the rotation matrixd3ddev->SetTransform(D3DTS_WORLD, &(matRotateY*matMove));    // set the world transform (rotates then moves the object)// Draw second sphere...

##### Share on other sites
Thank you, you guys help a lot ^_^

1. 1
2. 2
3. 3
Rutin
18
4. 4
JoeJ
13
5. 5

• 14
• 10
• 23
• 9
• 57
• ### Forum Statistics

• Total Topics
632639
• Total Posts
3007607
• ### Who's Online (See full list)

There are no registered users currently online

×