Skip to main content
gamedev.net
🔒 Locked

about transformations.

Started by ulfhiden Oct 15, 2005 at 10:24 AM 0 replies 800+ views
Original Post
ulfhiden
ulfhiden
In advance i apologize if this is the wrong forum. My problem is that im having a hard time conceptulzing transformations. Espcally having to do with the eye coordinates.For example say you have some objects you want to draw in world corridnates (12,34,21) (12,34,-200)(56,76,400) and camera is at say (12,34,100). Now i wnat this coordinates to be world cooridantes so i do something like load idnetity matrix translate for eye coordiatees push stack draw object pop stack and repeat does this place the camera in world coridnates at (12,34,100) and then the objects at (12,34,21) (12,34,-200)(56,76,400). It doe this be esentaily turnig the eyes cordinates to (0,0,0,)and translating the objects cordinates relative to the eye is this correct or am i completely off mark.
Nickolay_Smirnov
Nickolay_Smirnov
If you want to draw some objects just to look at them, do like this

void CALLBACK Resize (int w, int h)
{
glViewport (0, 0, w, h);

glMatrixMode (GL_PROJECTION);
glLoadIdentity();
gluPerspective (45.0f, (float) w / (float) h, 0.1f, 1000.0f);
glMatrixMode (GL_MODELVIEW);
glLoadIdentity();
}

void CALLBACK display()
{
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glPushMatrix(); // for animation

glTranslated (0, 0, -10); // by default camera is in (0, 0, 0)
// so we translate our scene "in" the screen

...

glPopMatrix(); // don't forget to return to (0, 0, 0);

glFlush();
auxSwapBuffers();
}

So you can always rotate/translate your objects to the preffered point.

Cogito ergo sum (Descartes)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.