Zoom window rectangle drawing

Hi All,

When you need to make a zoom window command on a OpenGL surface, you need to draw in 2D screen coordinates a rectangle while dragging.

Now we are drawing this rectangle re-drawing the whole scene and of course when the scene become complex the fps rate drops too much for a pleasant user experience.

Is it possible to:

  1. keep a copy of the screen surface
  2. draw current rectangle
  3. recover the old screen
  4. draw the new rectangle

using the front and back buffer?

Thanks,

Alberto

Try to use WGL_ARB_buffer_region (if exist). If not then:

  1. Draw scene to texture, refresh as you need. Use FBO or PBuffer, and if everything fails, draw to backbuffer and use glCopyTexImage2D call to grab backbuffer content to texture.

  2. Draw screen aligned quad with above texture + selection rect

Thanks yooyo,

I will try immediately the WGL_ARB_buffer_region extension.

Alberto

WGL_ARB_buffer_region It is not even present in my FireGL ATI board. Does it have some alternative names?

I will try the FBO texture approach, next.

Thanks,

Alberto

Yooyo,

I don’t think the FBO approach is robust enough when the Full Screen AntiAliasing comes into play. It involves even the GL_EXT_framebuffer_multisample extension that some GPU don’t support at 100%.

Are you sure that it is not possible to do this only using the front and back buffers?

Thanks,

Alberto

According to realtech GLView database, WGL_ARB_buffer_region is present on FireGL cards. It’s a WGL extension… not GL extension… To get list of WGL extensions use wglGetExtensionsStringARB.

Thanks yooyo,

I get the following error message:

Unable to find an entry point named 'wglGetExtensionsStringARB' in DLL 'OPENGL32.DLL'.

Where should I look for this method?

Thanks,

Alberto

For this use case, glCopyTex(Sub)Image2D will do fine.

You’ll need to use wglGetProcAddress to retrieve this.

Hi ZbuffeR,

Do you mean this approach?

http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=259888#Post259894

Thanks,

Alberto

Yes.
The downside of using copytex alone without FBO is that it does not works well when moving overlapped windows (framebuffer for parts covered by other windows is undefined), but during an interactive command it is not a problem.

ZbuffeR,

We need only to drag a outlined rect on the surface without rendering the entire scene again. Many OpenGL program do this.

What is the best approach for this specific purpose?

Thanks,

Alberto

And what is the problem with the post you linked ? It has all the features you need.

EDIT : at least that is the best for me, in terms of compatibilty and performance across a wide range of OpenGL implementations.

Ah, ok. Thanks. :wink: