clearing sub-region of the window, or viewports

Hi,

in a program, I have a window which is divided into 4 viewports. On each of these viewports is rendered the same scene but with different views.

For speed issues I was thinking about rendering some of these viewports not all the frames.

To my opinion, I can use FBO to do that, and render each view in a separate FBO. Then apply the result of the FBO when I want, on the viewport I want.

I just wanted to know if there was some other ways to do that. For conveniencies I’d like to keep a single OpenGL window divided into viewports. How far is it possible to do it without the use of FBO ?

Thanks.

EDIT: Please note that my program runs on Linux and Windows.

Platform is irrelevant, we’re talking hardware. :wink:

OK, per the documentation for glClear; http://www.opengl.org/sdk/docs/man/xhtml/glClear.xml

The scissor box bounds the cleared region.

So in theory setting a scissor box bounded to the subrect you want to clear, then calling glClear, should be all you need.

in theory setting a scissor box bounded to the subrect you want to clear, then calling glClear, should be all you need.
Might work.
The poster must also bypass the code that renders the other 3 viewports.
In this case, what happens when swapbuffers is executed?

Thanks for replies.

@mhagain: plateform is not that irrelevant since WGL_ARB_buffer_region extension (http://www.opengl.org/registry/specs/ARB/wgl_buffer_region.txt) :wink:

I made very quick tests (activate scissor only for the “active” viewport). And the test works fine as you both expected. The rendering is a bit faster too.

@MaxH: I have a fifth viewport that has the full window size. And I swap buffers after disabling the scissor test. I’ll try to check if I can disable the scissor after swaping buffers, hopefully tomorrow.

Thanks !

Ah well, if we’re talking extensions then the balls outta the park. :wink:

Glad to hear it worked for you.

I also use a single window divided into multiple viewports in my sims. I can have 1, 3, or 4 viewports on the screen into which I can display about a dozen different scenes. So we have similar situations. I never thought about trying to render one of the viewports without updating the others. I’m satisfied with the update speeds I’m getting, plus it’s usually the case that if one of my scenes change, all of them do.

Good luck.

I would just use FBO since it is platform independent and headache free.

wgl_buffer_region is pretty damn ancient. I remember using that.

I made further looks about this. For now I’ll stay with this: the resulting increase with the use of scissor tests is absolutely not negligible. The only drawback is that the scissored viewports rendering looks a bit ugly (since I don’t render them each frame)…

But anyway, that is not important for me. This editor is just a tool for helping me at this stage. Later I’ll certainly use spatial partitioning and such. The thing is that I can have models about 200000 polygons (or even more), and it definately kills down my graphic card to draw them 4 times, so spatial partitioning is a bit useless under this condition…

The fact that I’m still prefering scissor than FBO is that it’s more quick to do the job, and it’s more certainly faster (since there’s no need to copy back from the buffers - even if this step if very very fast).

Thanks again for the trick.