Rotate an Object About Its Own Axes in OpenGL — Matrix vs. Quaternion Approaches

A clear, modern guide to rotating a model around its own X/Y/Z axes (not the world axes) in legacy OpenGL. It explains how post-multiplication and transform order affect results, why naïve glRotatef calls use world axes, and how to fix this by accumulating orientation with either a persistent model matrix or a quaternion (GLM). The write-up also covers common pitfalls—gimbal lock, numeric drift, and accidentally rotating the projection—plus practical best practices (re-orthonormalizing, avoiding per-frame glGetFloatv), and includes a minimal, working example that “just works” for local rotations.

C++ PROJECTS

8/23/20251 min read

My post content