I made a simple OpenGL program that draws a 2D texture to the screen. When you resize the window, it doesn't adjust properly, so to fix that, I would just run the projection matrix code again:
if (windowSizeChange)
{
std::cout << "Window resized." << std::endl;
std::cout << windowWidth << " " << windowHeight << std::endl;
windowSizeChange = false;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0, windowWidth, windowHeight, 0.0, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
}
However, running this code warps the image. To my understanding, to make it so I can draw 2D-like on the screen, my texture is drawn using an orthographic projection matrix which means there is a plane that is "parallel" with the window port or something like that which I draw on. When I try to re-make it to accommodate for the new window size, it doesn't adjust properly. What's going wrong with this code?