How to use glOrtho() in OpenGL?

Have a look at this picture: Graphical Projections The glOrtho command produces an “Oblique” projection that you see in the bottom row. No matter how far away vertexes are in the z direction, they will not recede into the distance. I use glOrtho every time I need to do 2D graphics in OpenGL (such as … Read more

Confusion between C++ and OpenGL matrix order (row-major vs column-major)

matrix notation used in opengl documentation does not describe in-memory layout for OpenGL matrices If think it’ll be easier if you drop/forget about the entire “row/column-major” thing. That’s because in addition to row/column major, the programmer can also decide how he would want to lay out the matrix in the memory (whether adjacent elements form … Read more

object loader in opengl

// Get the number of vertices obj_file >> md->vertices; // Get the number of faces obj_file >> md->faces; Read the spec again. That’s not how OBJs work. You have to parse out the vertexes/texture coordinates/normals/faces as you go along. Use something like this: #include <GL/glut.h> #include <glm/glm.hpp> #define GLM_ENABLE_EXPERIMENTAL #include <glm/gtx/component_wise.hpp> #include <vector> #include <fstream> … Read more