Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » GLCtrl and Docking: do they work together as expected?
GLCtrl and Docking: do they work together as expected? [message #28734] Tue, 14 September 2010 13:45 Go to next message
281264 is currently offline  281264
Messages: 270
Registered: June 2010
Location: Spain
Experienced Member
Hi,

I have spotted a, IMO, weird behaviour of several GLCtrls when working with Docking. Please test attached code. Two GLCtrl structs are created: one is made dockable. When this one is made auto-hide and you further take advantage of it, the main Topwindow (which contains the other GLCtrl) fails to re-paint correctly.

I have noticed that GLPane::Init() function is called every time the auto-hide feature is used, and consequently a new OpenGL rendering context is generated and made current. Is this a desirable behaviour? Why is going on this weird behaviour?.

For example, when the other dockable controls (trees) are made auto-hide, this feature does not interfere at all with the OpenGL Ctrl in the main application Topwindow.


Cheers,

Javier
Re: GLCtrl and Docking: do they work together as expected? [message #28736 is a reply to message #28734] Tue, 14 September 2010 16:16 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
Autohide and GLCtrl really aren't very compatible. The Autohide uses a popup control, which means the GLCtrl is moving from one native window to another. This is what's causing the repeated GLInit calls and there isn't anything you can do to stop it since it required for the GLCtrl to work

My advice would be to disable Autohide either on the whole app or just the DockableCtrls that hold GLCtrls.
Re: GLCtrl and Docking: do they work together as expected? [message #28738 is a reply to message #28736] Tue, 14 September 2010 16:50 Go to previous messageGo to next message
281264 is currently offline  281264
Messages: 270
Registered: June 2010
Location: Spain
Experienced Member
Roger. I shall do that.

Allow me to ask some more questions (I have poste one of them in this forum):

1.- How is Docking dealing with the OpenGL rendering context creation? I guess that for using the main TopWindow as OpenGL device context, GLCtrl does it (this is obvious); but what about the second GLCtrl object, is it treated like a new window and hence “new window”=>new hDc=> new hRc created?

2.- Then if we have two OpenGL hRC, which of them is the current?
Allow me to ask some more questions (I have poste don of them in this forum):

1.- How is Docking dealing with the OpenGL rendering context creation? I guess that for using the main TopWindow as OpenGL device context, GLCtrl does it (this is obvious); but what about the second GLCtrl object, is a new “window”=>hDc=>hRc created?

2.- Then if we have two OpenGL hRC, which of them is the current?

3.- How can I make one of them “current” (and therefore be able to control the rendering/interaction with the user?

4.- How a multithreading feature can work in this context?

5.- When a dockable ctrl is not docked, how is it considered? Like a new TopWindow?

6.- How to interact with it (for example how to “say” the others GLCtrls, “please Refresh() yourselves”?
Many thanks.

Best wishes,

Javier




Many thanks.

Best wishes,

Javier
Re: GLCtrl and Docking: do they work together as expected? [message #28744 is a reply to message #28738] Tue, 14 September 2010 19:21 Go to previous messageGo to next message
281264 is currently offline  281264
Messages: 270
Registered: June 2010
Location: Spain
Experienced Member
An additional post to the previous:

How a GLCtrl of the attached example can access one of the others controls? For instance, If I desired to write a message in one of the arrayctrls after a click in the GLCtrl window is made, how to do it?

Cheers,

Javier

Re: GLCtrl and Docking: do they work together as expected? [message #28777 is a reply to message #28738] Thu, 16 September 2010 10:45 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
1- Yes
2- When Painting begins wglMakeCurrent is called to make the GL context associated with the GLCtrl active. wglGetContext can determine which context is active, but this is really only useful for checking that you have a context active at all (modal windows can change the context for instance).
3- wglMakeCurrent. This is not currently exposed by the standard GLCtrl. I suggest just branching GLCtrl as I did in the package I posted in the other thread:
    void     StartDC() const                    { wglMakeCurrent(GetDC(), GetRC()); }
    void     StopDC() const                    { wglMakeCurrent(NULL, NULL); }
There will be other stuff you want to add also.
4- You will have to syncronise as OpenGL (ASFAIK) will only accept calls from the main thread.
5- Yes
6- Design decision. Store the controls globally, create an event system, use callbacks.
7- As above.
Re: GLCtrl and Docking: do they work together as expected? [message #28780 is a reply to message #28777] Thu, 16 September 2010 12:16 Go to previous message
281264 is currently offline  281264
Messages: 270
Registered: June 2010
Location: Spain
Experienced Member
Many thanks for the answer.

With regard to the visibility of GLCtrls, I have created pointers, so every control points the others. With this, one control can control the others, even being a TopWindow under Docking.

What amazes me is why auto-hide distorts the central GLCtrl.

Best wishes,

Javier
Previous Topic: GLCtrl: does it support multisamplig feature?
Next Topic: Visibility of objects.
Goto Forum:
  


Current Time: Sat Mar 30 00:18:01 CET 2024

Total time taken to generate the page: 0.01825 seconds