Reshape function and multiple viewports

Hello everyone, I'm trying to learn OpenGl because I need it to pass an exam, but I don't understand how to write the right reshape function if I have two viewports. The first one is bigger and I use gluPerspective to draw in it, the second one is on the bottom of the window and I use gluOrtho2D.

There is no "reshape function". Whether you have a "reshape function" at all is entirely up to you. And if you have one, what you do wihtin it is also entirely up to you.

If you need to use a perspective projection sometimes and an orthographic projection other times, then you will need to set one first, do rendering with that, then set the other, and do rendering with that. How you accomplish this is entirely up to you; you will need to make sure that your rendering function has the information necessary to do this. This will often involve storing the window's size somewhere and using that size in your rendering function.

You've made the mistake of thinking that the way a particular tutorial looks is somehow enforced or required. That there must be a "reshape function" and it must call either gluPerspective or gluOrtho or whatever. It's your code; do whatever you need to to make it work.