I'm having some troubles with my game code. I'm developing a Voxel Engine and everything is fine, but sometimes (like 30% of times) when I build and run my project, the X and Z axis got inverted (I know it because the model position and Camera motion), and I dont know why this is hapenning.

May this is a bug on my graphic card, or my code is broken is some place? If so, any clue where to start looking for?

Here are two pics to show what i'm saying, I didnt made any change in code, just compiled twice and got it like this:

Normal Axis Inverted Axis (Problem)

Here are my settings:

Compiler: VS 2013 Express PC: Dell Inspiron R14 SO: Windows 8 Graphics Card: NVIDIA GT 630M and Intel HD Graphics 4000 Libs: GLFW 3.0.4, GLEW 1.10, GLM OpenGL Context: 4.0

  • \$\begingroup\$ You sure you're not just multiplying your matrixes wrong ? Or simply multiplying with a negative number? \$\endgroup\$
    – Sidar
    Feb 18, 2014 at 23:17
  • 2
    \$\begingroup\$ Not a chance is it because your computer configuration. I suggest deploy breakpoints and move slowly through the initialization (obviously not for every cube, just a few of them). \$\endgroup\$ Feb 18, 2014 at 23:18
  • \$\begingroup\$ @Sidar, if so, why sometimes (with no change on code) it works fine? \$\endgroup\$ Feb 18, 2014 at 23:19
  • 1
    \$\begingroup\$ I am 100% it's a bug in your math library, or using it. \$\endgroup\$
    – concept3d
    Feb 18, 2014 at 23:19
  • \$\begingroup\$ @JánosTuránszki, thanks for the tip, I'll check anyway. But again, the strange thing is it works fine sometimes (with no code change). \$\endgroup\$ Feb 18, 2014 at 23:19

1 Answer 1


I found the main problem. My Camera rotation didnt got an yAxis clamp, so when I build my project and click on it, the mouse position was different and sometimes made the yAxis be 180 or -180, which caused the issue.

A simple clamp solved it:

yAxis = glm::clamp(yAxis, -90.0f, 90.0f);

Thanks for those who help me out!


This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .