PDA

View Full Version : Rotation does not work in Transform GLSL



charisma_tubagus
12-01-2016, 08:38 AM
Hi,

I am trying to create a simple game engine using LWJGL. Yes I use Java instead of C++. I try to create a 3D transformation consisting of translation and rotation using custom classess, Matrix4f, Transform, and Shader. Next, I used vertex shader, and fragment shader in the program. However, when I try to run the program the object only translates not rotate. I still could not know the which part of the program was wrong.

Please help me solve my problem.

The project file is here:
http://www.mediafire.com/file/6ct3l18s36smpsx/3DGameEngine.rar
I used LWJGL library, and eclipse.

Silence
12-01-2016, 10:39 PM
Just one hint: multiply your matrix after each transform. Ie:



Matrix4f matrix;
matrix = Matrix4f.Identity();
matrix *= Matrix4f.CreateTranslation(Vec3f(x,y,z));
matrix *= Matrix4f.CreateRotation(alpha, Vec3f(a,b,c));
...


Or something like this.

If I'm far, please post relevant parts of the code and give more details.