Quarternion - confusing opposite effects

I am using column-major with view matrix. If using row-major, it causes quaternion rotation confusing opposite effects that I tried to rotate or move object. With column-major, I was able move or rotate object correctly.

glm::mat4 cview = cam.rot; // column-major matrix
glm::mat4 rview = glm::transpose(cam.rot); // row-major matrix

// av = angular velocity
// tv = travel (move) velocity
glm::vec3 wv = av / 2.0;
glm::quat dr = glm::quat(1.0, wv.x, wv.y, wv.z) * qrot;
glm::quat qrot = glm::normalize(qrot + dr);
glm::vec3 cam.pos -= glm::conjugate(qrot) * tv;

// in GLSL code
gl_Position = proj * view * vpos;

If using major-row view matrix, how I do correct quaternion behavior from confusing opposite effects?

How to rotate qrot with desired angle like rotate 90 degrees?

GLM, by default, generates matrices in column major order. So… that’s what all of its functions will do.

It’s best to pick a major ordering and stick with it everywhere. There shouldn’t be places in your code that are row major and other places that are column major. It’s an arbitrary convention, and the only advantage you might have with a particular ordering is that you’re using tools that support that ordering.

GLM is a column-major system by default. GLSL interface blocks also presume column-major ordering. So… do that. If you’re using some other tools that generate row-major matrices, then convert those matrices to column-major at the point where you’re using those other tools.

Also, I don’t see any matrices in any of your code, so its unclear where exactly you are “using major-row view matrix”.

It’s an arbitrary convention, and the only advantage you might have with a particular ordering is that you’re using tools that support that ordering.

But does it have any bearing on cache locality?

Realistically, no. Almost any operation involving matrices is going to access all sixteen elements.