Note that there are some explanatory texts on larger screens.

plurals
  1. POMultiple viewports interfering
    primarykey
    data
    text
    <p>How can I achieve a clean separation between 2 viewports? </p> <p>I have 2 viewports, one takes full screen length, the other one needs to be less or equal to a quarter of the screen size (I want it to be a map). The problem is they keep interfering, I get to see in the small viewport content from the big one.</p> <p>Here's the <code>display()</code> function I'm using:</p> <pre><code>glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glEnable(GL_LIGHTING); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glViewport(0,0,newWidth,newHeight); gluPerspective(45,(float)newWidth/(float)newHeight,0.2,500); //setup view glMatrixMode(GL_MODELVIEW); glLoadIdentity(); camera.render(crntMode, radiusNew); //ground glColor3f(0.5,0.5,0.5); draw_ground(50,50,2,2,-2); ... ... ... glMatrixMode(GL_PROJECTION); glLoadIdentity(); glViewport(newWidth / 2, newHeight / 2, newWidth / 2, newHeight / 2); gluPerspective(45,(float)newWidth/(float)newHeight,0.2,500); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); camera.render(mini_map, radiusNew); //ground glColor3f(0.5,0.5,0.5); draw_ground(50,50,2,2,-2); ... ... ... //swap buffers glutSwapBuffers(); </code></pre> <p><img src="https://i.stack.imgur.com/Cljq1.png" alt="Both viewport cameras are following the character, one from a third person perspective, the other one from top up. It might be harder to see, but the background from the mini-map viewport is interfering with large one (the large on is acting almost as a background for the mini-map). Sometimes the large viewport covers the small viewport."></p> <p>Both viewport cameras are following the character, one from a third person perspective, the other one from top up. It might be harder to see, but the background from the mini-map viewport is interfering with large one (the large on is acting almost as a background for the mini-map). Sometimes the large viewport covers the small viewport.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload