Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8548977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:37:16+00:00 2026-06-11T13:37:16+00:00

After figuring out the answer to my previous question I have found the cause

  • 0

After figuring out the answer to my previous question I have found the cause to be some kind of mathematical oddity.

Using the GLM (OpenGL) library I create an orientation as follows

glm::gtx::quaternion::orientation = 
    glm::gtx::quaternion::angleAxis(pitchAccum, 1.0f, 0.0f, 0.0f) * 
    glm::gtx::quaternion::angleAxis(yawAccum, 0.0f, 1.0f, 0.0f);

Now if I create a matrix from this orientation it is no longer column major but somehow becomes row major

    glm::mat4 view = glm::gtx::quaternion::toMat4(orientation); 

In other words the 3 coordinates axes are found by accessing the matrix using row major indices

view[0][0], view[1][0], view[2][0]  // X axis
view[0][1], view[1][1], view[2][1]  // Y axis
view[0][2], view[1][2], view[2][2]  // Z axis

In other words the transpose of the rotation part.

The translation part of the matrix should still be set using column major in order for the final view matrix to work as intended.

view[3][0] = -glm::dot(glm::vec3(view[0][0], view[1][0], view[2][0]), position);    // Right
view[3][1] = -glm::dot(glm::vec3(view[0][1], view[1][1], view[2][1]), position);    // Up
view[3][2] = -glm::dot(glm::vec3(view[0][2], view[1][2], view[2][2]), position);    // Forward

Why is the rotation matrix flipped from column major to row major (transposed?) when using the orientation?

EDIT:

// Move forward
if (glfwGetKey('W') == GLFW_PRESS)
{
    //movement += glm::vec3(view[2][0], view[2][1], view[2][2]);  // incorrect
    movement += -glm::vec3(view[0][2], view[1][2], view[2][2]);   // correct
}
// Move backward
if (glfwGetKey('S') == GLFW_PRESS)
{
    //movement += -glm::vec3(view[2][0], view[2][1], view[2][2]); // incorrect
    movement += glm::vec3(view[0][2], view[1][2], view[2][2]);    // correct
}
// Strafe left
if (glfwGetKey('A') == GLFW_PRESS)
{
    //movement += -glm::vec3(view[0][0], view[0][1], view[0][2]);  // incorrect
    movement += -glm::vec3(view[0][0], view[1][0], view[2][0]);    // correct
}
// Strafe right
if (glfwGetKey('D') == GLFW_PRESS)
{
    //movement += glm::vec3(view[0][0], view[0][1], view[0][2]);  // incorrect
    movement += glm::vec3(view[0][0], view[1][0], view[2][0]);    // correct
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T13:37:17+00:00Added an answer on June 11, 2026 at 1:37 pm

    A matrix M which transforms from the space A to the space B has the basis vectors of space A, but expressed relative to space B.

    The camera matrix transforms from world space to camera space. Thus, the basis vectors of the camera matrix are the basis vectors of world space, as seen from camera space. Not the basis vectors of camera space.

    The orientation of the camera, relative to world space, is the inverse of this transformation. And since the inverse of a rotation matrix is it’s transpose, you have your issue.

    The problem isn’t with the matrix; the problem is with the difference between what you think the matrix says and what it actually says.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Update: Question updated after figuring out what was causing the ASP.NET/Razor errors. I have
Question: Can I override default functions in Javascript? Background: After figuring out that I
Having some trouble figuring out why my ImageView buttons stop working after I change
I am having trouble figuring out how to 're-render' a page after a POST
Even after studying the examples , I'm having trouble figuring out how to extract
After a long search I'm still confused about it although I found some related
After figuring out (via SO, of course) that the error for a bad $ftp
After switching to AS3, I've been having a hell of a time figuring out
I'm having trouble figuring out how to solve this issue. I have a file
i have a problem figuring out exactly whats wrong here: -(void) fireShots { [laserBeam

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.