I am trying to have one of the viewports in my window display an orthographic projection of a teapot.
mat4 view = translate (identity_mat4 (), vec3 (0.0, 0.0, -40.0));
mat4 persp_proj = perspective(50.0, (float)width/(float)height, 0.1, 100.0);
mat4 model = rotate_x_deg (identity_mat4 (), 40);
glViewport (0, 0, width / 2, height / 2);
glOrtho(0,400,0,300,0,1);
glUniformMatrix4fv (proj_mat_location, 1, GL_FALSE, persp_proj.m);
glUniformMatrix4fv (view_mat_location, 1, GL_FALSE, view.m);
glUniformMatrix4fv (matrix_location, 1, GL_FALSE, model.m);
glDrawArrays (GL_TRIANGLES, 0, teapot_vertex_count);
This is the part in the code that I would like to use glOrtho
to draw an orthographic view of the teapot. First of all, am I even using glOrtho
correctly? I think I am, but I'm not getting what I hopped to get so I'm doubt I am.
Why doesn't what I have work, and how I would go about fixing it?
If I am supposed to put glOrtho
in a specific place it would be helpful to know where.
Also, as I am supposed to have several viewports will all of the viewports have an orthographic projection after that?
Here's my entire program code snipet is taken from lines 192-204