I looked around and never saw, nailed down, exactly what each matrix does and what operations form them (this is how the real function calls). This is what I am looking for. Or at least a description of the process and a couple of examples with native functions to see how to do it! Anyway, here are some details if they are useful:
I am creating a perspective game from top to bottom (so the camera locks down, but can rotate and move along the XY plane), but since I will have some 3D elements (along with some things that are strictly 2D) I think that a perspective projection will work OK. But I wonder what commands are needed to form a spelling projection ...
I am analyzing the view that will be made by translating the camera coordinates to the origin, rotating to rotate the camera, translating them back to where they were, and then zooming to enlarge? But just what functions and objects will be involved, I'm not sure.
And for storing the rotation of any given object, a quaternion is apparently the best choice. So this will determine the projection of the model? If I manage to make my rotation simplify the two-dimensional case of one angle, will the quaternions be wasteful?
And do all these matrices need to be regenerated from each frame? Or can they be changed in some way to fit the new data?
I would rather use eigen for this instead of a manual library, but I need something to work to figure out exactly what is happening ... I have all the GLSL settings and uniform matrices that feed into rendering with my VAO, I just need to understand and make them.
Editing:
My vertex shader uses this standard setup with 3 uniform matrices times vec3:
gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(in_Position, 1.0);
Can mat3s and vec2 be used to achieve better performance in purely 2D cases?
c ++ game-engine opengl eigen
user173342
source share