OpenGL 3D Game Tutorial 8: Model, View & Projection Matrices

ThinMatrix · 199K views · 2014 · 20:54

Open on YouTube

Computer graphics & renderingGame programming & enginestutorial

Why Stack Overflow recommends it

Stack Overflow users link it when asking about LWJGL and OpenGL projection matrix problems, since they are following this tutorial and their code breaks at this step.

Recommended by 0 people across 0 different months, 2017 to 2020.

What it is

Episode 8 of ThinMatrix's LWJGL series on building a 3D Java game with OpenGL. It builds a rotating 3D cube by combining model (transformation), view and projection matrices in the vertex shader, and lists common pitfalls like uniform locations and near plane clipping.

What people said

Cites Thurarcier · 2017-03 · Stack Overflow · on “Problems with Object Rotation”

Here is the video of the problems: [LINK] Here are the problems with my rotation: yaw - when upVector.z/lengthUpVector == -1 (which is top facing forward), not rotation around z but rotation around y occurs yaw - when upVector.x/lengthUpVector == 1 (which is top facing rightward), not rotation around x but rotation around y occurs pitch - when upVector.x/lengthUpVector == 1, not rotation around y but rotation around x occurs roll - works In a similar post: OpenGL - Object local rotation [LINK] ..an other user found it to be a problem that "roll operation works like it should but if i turn it to face for example (1,0,0) it behaves like pitch", whereas I want my rotations to change like this.

Cites BRHSM · 2018-10 · Stack Overflow · on “Adding ProjectionMatrix to entity results in wierd behavior when rendering”

Introduction to the problem: I'm working on a game engine using the LWJGL library following this tutorial [this video] . However, I'm trying to make it so that there is a real division between the main engine and the game itself. I've therefore complicated the project a whole lot and I think this is causing some problems as the ProjectionMatrix doesn't work as explained in the video. What am I doing: Creating the ProjectionMatrix: In order to create a ProjectionMatrix I created the a method which creates it for me: public static Matrix4f createProjectionMatrix(float aspectRatio, float fov, float nearPlane, float farPlane) { float y_scale = (float) ((1f / Math.tan(Math.toRadians(fov / 2f))) * aspe

Cites retrooper · 2020-05 · Stack Overflow · on “LWJGL OpenGL Projection Matrix Issue”

I was in the middle of episode 8, he ran, his object rendered but mine didn't. I won't continue while mine isn't working. Edit: here is the video [this video]