In OpenGL, all you need to do is call glViewport() with the new window dimensions and everything you render is stretched to fit inside that rectangle. This is almost
what you want. The next thing you'll want to do is ensure the aspect ratio is still correct which will involve changing your projection matrix using either glOrtho or glFrustrum depending on whether you're doing 2D or 3D respectively. Pick one dimension as the "master" dimension (usually it'll be the height), and compute the width you need against this height according to your desired aspect ratio.
Eg. for a 16:9 ratio... width = (16.0 * height) / 9.0.