Without the perspective projection and view matrix my scene is fine:
If i use the camera the result is weird:
When i'm using the projection combined with view/camera matrix i always(even if move in every direction) get an empty screen or as i like to call it: the "Black Screen of Faliure".
Model Mat4: (model rotation on x-axis)
1.0 0.0 0.0 0.0
0.0 0.4888726 0.8723553 0.0
0.0 -0.8723553 0.4888726 0.0
0.0 0.0 0.0 1.0
View Mat4: (Camera slightly moved and rotated on y-axis)
0.94107544 0.0 0.33819667 -0.53266037
0.0 1.0 0.0 0.0
-0.33819667 0.0 0.94107544 2.4321942
0.0 0.0 0.0 1.0
Projection Mat4:
1.299038 0.0 0.0 0.0
0.0 1.7320509 0.0 0.0
0.0 0.0 1.002002 -2.002002
0.0 0.0 1.0 0.0
perspective proj calculation:
thf=tan(torad(60)/2); ar=800/600; zn=1; zf=1000;
1/(thf*ar) 0 0 0
0 1/thf 0 0
0 0 (-zn-zf)/(zn-zf) 2*zn*zf/(zn-zf)
0 0 1 0
My Vertex Shader:
#version 330
attribute layout(location = 0) vec3 Position;
attribute layout(location = 1) vec3 TexCoord;
attribute layout(location = 2) vec3 Normal;
out vec3 TexCoords;
uniform mat4 Model;
uniform mat4 View;
uniform mat4 Projection;
void main(){
gl_Position = Projection * View * Model * vec4(Position, 1);
TexCoords=TexCoord;
}
Turns out that there sometimes a boolean can screw you badly.
glUniformMatrix4(UniformHandle, true, ubo); // true for row-major order