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

  • Home
  • SEARCH
  • 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 8180659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:15:34+00:00 2026-06-07T00:15:34+00:00

I am using glm::rotate to rotate a transformation matrix for a cube in a

  • 0

I am using glm::rotate to rotate a transformation matrix for a cube in a scene.

"cube->t = glm::rotate(cube->t, stepTime * 50.f, glm::vec3(0.f, 1.f, 0.f));" is called once per frame, where cube->t is the matrix in question.

The strange thing is that over the course of 20 minutes (or two minutes if I rotate by stepTime * 5000.f instead of stepTime * 50.f), the cube scales noticeably on the X and Z axes, where the scaling on those two axes is the same at all times (the height of the cube never changes, but the width and depth change by exactly the same amount). In the case of 5000.f, becoming smaller, and with the normal 50.f or 100.f, becoming larger.

I thought this might be a question of rounding error, but other than that I have no idea what could be causing it. Is this rounding error? Can I solve it by normalizing the matrix on a regular basis? Does glm have a function for normalizing matrices, or do I have to write one myself?

  • 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-07T00:15:37+00:00Added an answer on June 7, 2026 at 12:15 am

    If it is an incremental, cumulative, loss of precision: instead of in-place updating the cube, keep an original un-rotated cube and keep track of the total rotational angle. Then on each step create a cube from the original un-rotated cube, transformed by the total accumulated rotational angle. In this way your cube will not suffer from cumulative rounding problems.

    Edit: In response to discussion with Miles, a more appropriate answer:

    If you can separate the rotational and translation components of the transformation matrix, and the problem is primarily with the accumulation of rotation introducing shear or scaling, you can rectify the problem by extracting the angle from the rotational component and re-creating the rotation matrix with that angle but unit length.

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

Sidebar

Related Questions

I'm using glm::quaternions to rotate a vector around a certain axis. But the vector
I'm using lib glm ( http://glm.g-truc.net/ ) for test quaternion but I've a problem;
using this http://bl.ocks.org/950642 we can see how to add images to nodes, the question
Given the working code snippet glBufferData(GL_ARRAY_BUFFER, vertices->size() * sizeof(glm::vec3), &vertices->front(), GL_STATIC_DRAW); // Set the
I'm making a game using cocos2d-iphone, I want's to rotate a Texture2D of maybe
I am using glm maths library for the following problem: converting a 2d screen
Using report builder 3.0, I have a report that queries a cube. How do
hey im using GLM(made by nate robins) with SFML and opengl on mingw32 with
Using the http://www.ifans.com/forums/showthread.php?t=132024 post from another question i am allowing the user to enter
I'm drawing a flat disk using gluDisk() in my scene. gluDisk() draws the disk

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.