How can I expand one viewPort to "Full Screen"?

1.1k views Asked by At

I'm working on a project using JOGL API.

Now I am stuck at a point that is the followed:

-I run the program and it shows a Canvas divided in 4 viewPorts. The objective of the project is basically in each of the viewPorts we need to "project" an object from 4 diferent points of view. But first, we need to when clicking [1,2,3,4] to "expand"/"full-screen" the matched ViewPort.

My idea is when clicking any number create a new viewPort like this:gl.glViewport(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT). But this only creates a new viewPort with the size of the canvas.

How can I expand the "content" of any of the 4 viewPort to "enter" that new viewPort?

1

There are 1 answers

10
datenwolf On BEST ANSWER

I think you've got confused what glViewport does. I don't know what you think it does (not), but what it's specified to do is, to set the portion of the OpenGL window, to which to map the post-projection (NDC) space. Or in layman terms, you use it to determine where in the window things get drawn. If you want to render full screen: Make the window full screen and set the viewport to the window size.

If you want to "expand" an existing drawing, you have to set the proper viewport and redraw the parts in question.