Kameraperspektive
-
Hallo Ihr,
Zum Verändern des Projektionswinkels (Rotation der kamera um die eigene Achse)habe ich die OpenGL-Funktion gluLookAt(...)gefunden.
Leider weiss ich nicht wie mann sie verwendet. Hat jemand vielleicht ein par Hinweise bzw. ein Stück Beispielcode?
Dank euch, Gruss Tom!
-
Original erstellt von http://www.google.com/search?q=gluLookAt+tutorial
gluLookAt is part of the GLU (GL Utility Library) library and extends OpenGL quite a bit. A quick synopsis of this function is that it tells OpenGL the location and direction the "camera" should be viewing. The descriptions for the coordinates are as follows: (eyex, eyey, eyez) tell OpenGL the location of the "camera" or in this case, your eye; (centerx, centery, centerz) the location of where the "camera" points (or where you see); and finally, (upx, upy, upz) tells OpenGL how to orient the "camera" so that those coordinates are "up." That wraps up the function gluLookAt(). If you want to find out more, ask in the forums.Sei doch mal was kreativ und benutz google
-
Was die Funktion machen soll, parameter und so, war mir schon klar.
Nur funktioniert es bei mir nicht so, wie ich dachte, wenn ich es zb. in folgenden Code einbinde:int DrawGLScene(GLfloat sink, GLfloat speed, GLfloat knueppel)
{glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_BLEND);
glEnable(GL_SMOOTH);gluLookAt(0.0, 0.0, 1000.0,
0.0, knueppel, 0.0 //Einfluss Höhenruder
0.0, 1.0, 0.0);glLoadIdentity(); glEnable(GL_TEXTURE_2D);
glTranslatef(0.0f,-110.0f+sink,-3.f+speed);
InitTerra (); // Erdoberfläche f. Flugsimulation
...
}
steht gluLookAt an falscher Stelle, fehlen noch Funktionen?