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?

  • \$\begingroup\$ Could you link to the tutorial you are talking about please? \$\endgroup\$ – Soapy Jan 6 '15 at 15:45

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:

  1. set glViewport to the entire screen, render game
  2. set glViewport to the minimap size and location, render minimap

And do these on every frame.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.