In order to not use any deprecated functions and to learn I’m trying to make my own matrices, but my projection matrix is causing my drawing to disappear. I’ve tried looking this up and my projection matrix looks consistent with everything I’ve found, and the z coordinates of my triangle are within the near/far clipping values I made the matrix with. I suspect that I am misunderstanding something about clipping, any advice would really be appreciated.

My projection matrix code:

This is row major but I do set transpose to true in glUniformMatrix4fv, so that’s not the problem.

```
void Camera::makeProjectionMatrix(float FoV, float aspectRatio, float nearClip, float farClip){
float d = 1.0f / ( tanf(FoV*radiansPerDegree/2) );
projectionMatrix[0] = d / aspectRatio;
projectionMatrix[5] = d;
projectionMatrix[10] = (nearClip + farClip) / (nearClip - farClip);
projectionMatrix[11] = (2 * nearClip*farClip) / (nearClip - farClip);
projectionMatrix[14] = -1.0f;
projectionMatrix[15] = 0.0f;
}
```

My shader, which works fine if I remove the projection multiplication:

```
"#version 330
"
"layout(location = 0)"
"in vec4 position;"
"uniform mat4 P;"
"void main(){"
"gl_Position = P * position;"
"}";
```

Finally here’s my parameters and a before and after of a vertex multiplied by the matrix. I might have the aspect ratio inverted but I’ve tried both ways and that doesn’t seem to help.

```
makeProjectionMatrix(70.0f, 640.0f/480.0f, 0.10f, 10.0f);
//My triangle
VBO.add(0.6f, 0.6f, 1.0f);
VBO.add(0.2f, 0.6f, 1.0f);
VBO.add(0.6f, 0.2f, 1.0f);
//Coordinates of an unprojected verticie
(0.60, 0.60, 1.00, 1.00)
//Projected coordinates
(0.643, 0.857, -1.222, -1.00)
```

So my projected w is -Z which gives me confidence in the matrix. I don’t understand why z has become negative. The values I’ve used don’t seem like they should be clipped to me but that’s the only problem I can imagine going on here. Any advice would be great.