I'm creating a labyrinth in opengl, and I'm trying to create a minimap. For that, I thought of creating a viewport inside of a viewport. I already tried following a tutorial from Lazy Foo, and I can create the second viewport, but instead of putting a map inside the second viewport, it puts my whole game there. Do you know of any tutorial that can help me do what I want?
glViewport lets you control the part of the screen where the output of your gl drawing commands will get rendered. It affects the gl commands that you issue after setting up the viewport. So, if you want to render the game to full screen and a minimap to a small portion, then:
- set glViewport to the entire screen, render game
- set glViewport to the minimap size and location, render minimap
And do these on every frame.