I recently migrated to OpenGL 3.3 and I’m trying to draw a menu/title screen.
I’m leaving the Modelview Matrix as the identity matrix.
Am I right to assume that this means the ‘camera’ is at the origin, looking down the -z axis?
That means I should specify my vertices with a z component of, say, -1.
I’m not sure what the x and y components will be. It would be nice if 1.0 x or y unit == 1 pixel in the image, so I could specify corners like this, at the origin where the image size is 304x80 pixels:
float lverts[20] = {
0.f, 0.f, -1.f,
0.f, 0.f,
304.f, 0.f, -1.f,
1.f, 0.f,
304.f, 80.f, -1.f,
1.f, 1.f,
0.f, 80.f, -1.f,
0.f, 1.f
};
The Projection matrix I am setting with a function I think I found in this forum:
void BuildOrthoProjMat(float* amat, float al, float ar, float ab, float at, float azn, float azf){
float tx = -(ar+al)/(ar-al);
float ty = -(at+ab)/(at-ab);
float tz = -(azf+azn)/(azf-azn);
amat[0] = 2/(ar-al);
amat[5] = 2/(at-ab);
amat[10] = -2/(azf-azn);
amat[12] = tx;
amat[13] = ty;
amat[14] = tz;
}
I’m unsure what to pass for the left, right, bottom, and top (al, ar, ab, at). My screen width is 800 and screen height is 600.
Haven’t got anything draw yet.