opengl - moving object in the world towards a stationary camera -


I want to extend the camera, which is equivalent to taking the world back to the camera, I use Glut and glTranslate I'm working, but my question is how should I use it?

Let's assume that initially I'm starting with glLoadIdentity (), then I look at the point using gluLookAt, and then I did some translation / rotation in the model. In this case how should I use glTranslate to translate objects in the world so that they can proceed with the camera instead of their original / coordinates?

I thought that I can save the current matrix using glugget, load the identity matrix, then I want to translate it and then multiply the previous matrix using global matrix. But it was not working for me.

And if I want to enable yoke / pitch to use glare, then how should I do it? (This also means that to make the world rotate around the camera)

Sorry for my bad words or conceptual mistake, if any, I am quite normal for openness and graphic programming. And I'm still trying to understand the openpipe pipeline completely, especially the matrix part. Any detailed explanation about this will be greatly appreciated!

By reading your question, I think what you are trying to do is a fixed point About the camera (camera) imitates the movement of the camera by translating every other thing in the world

When you are saying that the camera is going to walk, in fact everything runs around the world, you Finally, see how difficult you are to run a box.Now imagine that you have hundreds! Not very fun :)

Fortunately, there is a ceremony that can help you, and you're already using it! GluLookAt () Your man is what makes it the matrix under the hood (not sure what the matrix is? Read this one :) Tell that it is multiplied by every other point in the world. This multiplication translates each point until it is in its proper position regarding the camera. So you are saying that by transferring the camera, the whole world is actually transferred to the camera relative to the camera, in this way we can do it all in one pass, instead of counting new positions of each point.

So, do you want to move the camera forward to the Z axis? Just call gluLookAt, but pass in the value of Eyes that you were previously called gluLookAt. Here's an example:

  gluLookAt (0,3,0,0,0,0,0,1,1,0); // It is out of initial state, (0,3,0) GluLookAt (0,2,0,0,0,0,0,1,0); // And this is the ending condition. Note that the value of the eye has decreased by one  

How to rotate, take a look at the second group of three parameters, the "center" parameter determines that the center of the camera Which point is in, that is, what the camera is watching In the previous example, the center point (0,0,0) was that you can rotate the camera by moving around these points around. How do you do it? It is a very complex subject in which a good math has been thrown, but the following link should help a bit:

Do not get frustrated if it feels very difficult, keep it up! If you need an explanation on this answer, feel free to ask me.


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -