Question

Is there a way to manipulate the field of view of camera when the camera is at 2 different positions in world space?

For example, In the first position, multiple mesh parts are transformed in different directions across the origin(where the camera looks at) until they form one mesh. This is done by calling glm::translate(), glm::rotate(), e.t.c before loading the vertices in the vbo.

In the second position, I want to transform the whole mesh (from above). Since I already loaded everything needed into the vbo and my models are drawn, I can't draw my new transformed mesh. Is there a way to draw my new transformed mesh without loading vertices into the vbo again?

And, if I have to load my vbo again, how do I go about it, since loading the vbo is dependent on how many parts the mesh is divided into.

Was it helpful?

Solution

Loading the vertex data into VBOs and transforming them has nothing to do with each other - stuff like glm::translate() or glm::rotate will not have any influence on the buffer contents - the only change some matrix. As long as you do not apply some transformation do you vertex data when you upload it to the buffer, no one else does. Typicalle, those transformation matrices are used when drawing the objects (by the vertex shader, on the GPU), so one can have moving objects and a moving camera without having to respecify the geometry data.

So in your case, it will be enough to just change the projection and view matrices and draw the obnjects again with those new matrices applied.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top