
Java lwjgl rotate about axis full#
The difference here is that instead of doing "half" an axis, I instead do half the degrees on a full axis. Matrix4f.rotate(timeSinceStart * (float) Math.toRadians(25), new Vector3f(1.0f, 0.0f, 0.0f), model, model) If I change things up by separating which axe is affected per rotation, the cube looks normal like in this video:Ĭode: Matrix4f.rotate(timeSinceStart * (float) Math.toRadians(50), new Vector3f(0.0f, 1.0f, 0.0f), model, model) The resulting cube rotates like this, oddly enough: I run the following on the model matrix: Matrix4f.rotate(timeSinceStart * (float) Math.toRadians(50), new Vector3f(0.5f, 1.0f, 0.0f), model, model) The resulting cube looks like this:īack to Java, I have set up a similar thing. Here they specify which Euler angles/axes to rotate around, and by the looks of it, specifying 0.5f for the X axis rotates it half the amount on X compared to Y here. The part that I'm curious about is the vec3(0.5f, 1.0f, 0.0f). The GLM library is used to rotate this matrix, using glfwGetTime() which returns the time in seconds since initialization. To elaborate on this, model is the model matrix.

The tutorial gives the following code: model = glm::rotate(model, (float)glfwGetTime() * glm::radians(50.0f), glm::vec3(0.5f, 1.0f, 0.0f)) ```

I'm at the part where a cube has just been rendered and is rotating. It's going quite well but I've stumbled upon something that may be caused by a difference in implementation, unless I'm doing something wrong. I'm currently following the OpenGL tutorials over at except I'm doing it in Java instead of C++.
