I tryed to write my own GLSL #version440 schader but when I add my projectionMatrix I get a black screen, I think because of any reason my matrix is 0 (when I use the vertex coords for the color the object is black (matrix is not added to the vertex but to the color…))
Matrix :
// projectionMatrix is defined
void Perspective(float fovy, float aspect, float near, float far)
{
fovy = degree*90;
float f;
f = 1/tan(fovy/2);
First, the matrix needs to be transposed. The above would (almost) be typical for a perspective projection if the matrix was in row-major order, but OpenGL uses column-major order by default.
Second, index 15 should be 0, not 1. For a perspective projection, the W component should be strictly proportional to the Z component. Affine transformations (such as rotation, scale, translation and orthographic projection) simply copy the W component (i.e. the bottom row is [0 0 0 1]), but a perspective projection isn’t an affine transformation.
Why are you setting the W component to 10? This effectively scales vertexPosition by 1/10 (this only affects the computed depth value, so the effect is as if you scaled the near and far distances by 10).