PDA

View Full Version : Zoom window rectangle drawing



devdept
03-31-2010, 03:48 AM
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

yooyo
03-31-2010, 04:00 AM
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

devdept
03-31-2010, 04:58 AM
Thanks yooyo,

I will try immediately the WGL_ARB_buffer_region extension.

Alberto

devdept
03-31-2010, 05:36 AM
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

devdept
03-31-2010, 05:43 AM
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

yooyo
03-31-2010, 06:29 AM
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.

devdept
03-31-2010, 08:14 AM
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

ZbuffeR
03-31-2010, 09:32 AM
For this use case, glCopyTex(Sub)Image2D will do fine.

Dan Bartlett
03-31-2010, 11:17 AM
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?

You'll need to use wglGetProcAddress to retrieve this.

devdept
04-01-2010, 02:41 AM
Hi ZbuffeR,


Do you mean this approach?

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


Thanks,

Alberto

ZbuffeR
04-01-2010, 04:58 AM
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.

devdept
04-01-2010, 06:03 AM
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

ZbuffeR
04-01-2010, 06:18 AM
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.

devdept
04-01-2010, 07:01 AM
Ah, ok. Thanks. ;)