Keeping everything to scale when resolution changes?

So If my game is running in a window, I want everything rendered to be rendered INSIDE the window. But right now, if I make the window smaller, stuff is just cut out, and if I make it bigger, then their’s just blackness around everything being rendered. How do I make it so everything is rendered to scale when the window size or resolution changes? Hope you know what im asking here… If not I’ll try to reword it. (I’m using LWJGL and OpenGL by the way)