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 » U++ Library support » U++ Library : Other (not classified elsewhere) » More GLCtrl
More GLCtrl [message #18650] Tue, 14 October 2008 18:51 Go to next message
kodos is currently offline  kodos
Messages: 111
Registered: March 2008
Experienced Member
Hi,

I found again some problems in the GLCtrl. It seems as it isn't that easy to fix a problem in there without introducing a new one Wink
So I now made a test case that should test most of the things. Also included is my extended GLCtrl class that features the functions GLInit, GLResize and GLDone on windows and an helper class to to use picking in OpenGL. But that shouldn't change the problems that you can see in the test case.

Here are the things that are currently broken:
-) Hide/Show does nothing on Windows Vista
-) The slider control doesn't refresh itself, if you move it on Windows Vista
-) The slider flickers on Linux, it looks like OpenGL wants to draw over the slider, but wouldn't it be better if frames would still be handled from U++ and the DHCtrl should fit inside the frames?
-) GLDone is not called on Linux after removing the control from the form. (This one is because the call should be made from BeforeTerminate from DHCtrl but this function is never called. The method that is used in the windows code also doesn't work because the State method is private on linux)

I hope the test case helps to find the problems Smile
And I would be glad if the picking helper class would made it to U++, so I don't have to maintain it on my laptop and pc Wink
  • Attachment: OpenGl.zip
    (Size: 7.63KB, Downloaded 314 times)

[Updated on: Tue, 14 October 2008 18:54]

Report message to a moderator

Re: More GLCtrl [message #18696 is a reply to message #18650] Fri, 17 October 2008 15:47 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
kodos wrote on Tue, 14 October 2008 12:51

Hi,

I found again some problems in the GLCtrl. It seems as it isn't that easy to fix a problem in there without introducing a new one Wink



To tell the truth, GLCtrl is a nightmare for me - mostly because I am not that good at maintaining stuff that I do not actually use... (And I do not use Vista as well...).

Mirek
Re: More GLCtrl [message #18699 is a reply to message #18650] Fri, 17 October 2008 16:24 Go to previous messageGo to next message
kodos is currently offline  kodos
Messages: 111
Registered: March 2008
Experienced Member
I understand that.

I think the biggest problem right now is that the DHCtrl (or more accurately the native control inside DHCtrl) is using the whole space of the DHCtrl, and the frames try to draw over it. I don't think this is the right behavior because as I understand it the area that the frames use shouldn't be usable from the control itself.
So the best solution imho would be if the "native control" inside the DHCtrl would be resized with respect to the frames. But I don't know how complicated this change would be. I am a bit lost in all the layout code Smile
Re: More GLCtrl [message #18701 is a reply to message #18699] Fri, 17 October 2008 17:04 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
kodos wrote on Fri, 17 October 2008 10:24

I understand that.

I think the biggest problem right now is that the DHCtrl (or more accurately the native control inside DHCtrl) is using the whole space of the DHCtrl, and the frames try to draw over it. I don't think this is the right behavior because as I understand it the area that the frames use shouldn't be usable from the control itself.
So the best solution imho would be if the "native control" inside the DHCtrl would be resized with respect to the frames. But I don't know how complicated this change would be. I am a bit lost in all the layout code Smile


Yes, you are perhaps right...

Mirek
Re: More GLCtrl [message #18748 is a reply to message #18701] Sun, 19 October 2008 18:20 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
I believe all should be fix now.

Note: DHCtrl was never intended to have children... Therefore, rather than rewriting half of CtrlCore, I have solved the issue by restructruing GLCtrl - it has now DHCtrl as child (and derives from ParentCtrl).

Thanks for hint and a quality testcase - I have put it to upptst for further use Wink

Mirek
Re: More GLCtrl [message #18749 is a reply to message #18650] Sun, 19 October 2008 18:53 Go to previous messageGo to next message
kodos is currently offline  kodos
Messages: 111
Registered: March 2008
Experienced Member
Ah, nice idea. I really didn't thought about that solution.
I will test it as soon as possible. Perhaps we could add an assertion somewhere that tests if somebody tries to add a frame to a DHCtrl.
Re: More GLCtrl [message #18768 is a reply to message #18748] Mon, 20 October 2008 14:26 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
luzr wrote on Sun, 19 October 2008 18:20

I believe all should be fix now.

Note: DHCtrl was never intended to have children... Therefore, rather than rewriting half of CtrlCore, I have solved the issue by restructruing GLCtrl - it has now DHCtrl as child (and derives from ParentCtrl).

Thanks for hint and a quality testcase - I have put it to upptst for further use Wink

Mirek


Eh, do you remember when some monthes ago I told you CtrlCore would need some strong refactoring ? Smile
Writing Linux GLCtrl was a nightmare because of the impossibility of having childs of windowed controls. I introduced them with some dirty hacks on Ctrl stuffs trying to not break previous behaviours, but just to Linux part.... and it was quite complicated because of optimizations in ctrlcore classes. And I know it's not a perfect implementation.....
I've seen some similar (but differently handled) hacks on windows DHCtrl code.

But I agree with you, it would be a *big* effort to clean up CtrlCore classes.

For other people not knowing the problem, OpenGL needs an underlying OS window (X11 or Windows). The problem arose because UPP controls don't have an underlying window (besides top ones) for speed (and other) purposes and were not foreseen to contain controls with a window handler.
All CtrlCore classes assume that no child control can have a window handle, so they use often the fact that there's no parent window to assume the control is a top one; in case of DHCtrl that's wrong. All hacks on linux part were aimed to remove this assumption.

Max

EDIT : btw, IMHO, the best would be to go in the direction on which child windowed controls are allowed. That's done on Linux part, it was not easy and it's not completely well implemented, but can be done. That would be a more uniform behaviour and would allow to embed some fancy windowed controls without the need of a wrapper class, and allowing them to be also containers for upp controls. (Linux DHCtrl can do almost all about it).

Max

[Updated on: Mon, 20 October 2008 14:30]

Report message to a moderator

Re: More GLCtrl [message #18775 is a reply to message #18650] Mon, 20 October 2008 20:02 Go to previous messageGo to next message
kodos is currently offline  kodos
Messages: 111
Registered: March 2008
Experienced Member
Ok, I have tested the new code and it works great so far except that there are no more events on the GLCtrl itself Smile

I have fixed the mouse events with the following code:
virtual Image MouseEvent(int event, Point p, int zdelta, dword keyflags) { return ctrl->MouseEvent(event, p, zdelta, keyflags); }

in the GLPane class. But I haven't found a function like that for the key events, and I don't know if I broke something else Smile
Re: More GLCtrl [message #18776 is a reply to message #18768] Mon, 20 October 2008 20:51 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
mdelfede wrote on Mon, 20 October 2008 08:26

luzr wrote on Sun, 19 October 2008 18:20

I believe all should be fix now.

Note: DHCtrl was never intended to have children... Therefore, rather than rewriting half of CtrlCore, I have solved the issue by restructruing GLCtrl - it has now DHCtrl as child (and derives from ParentCtrl).

Thanks for hint and a quality testcase - I have put it to upptst for further use Wink

Mirek


Eh, do you remember when some monthes ago I told you CtrlCore would need some strong refactoring ? Smile
Writing Linux GLCtrl was a nightmare because of the impossibility of having childs of windowed controls.



IMO you do not really appreciate nightmares if it would actually be directly possible....

Quote:


But I agree with you, it would be a *big* effort to clean up CtrlCore classes.



IMO, worst thing is that it would be *wrong* effort.

Most of complication in CtrlCore are caused by necessary "impedance mismatch" between U++ and underlaying host system API. "clean up" would most likely produced code that is nice, but does not work. Making it work would then bring us to the current status again...

Mirek
Re: More GLCtrl [message #18777 is a reply to message #18775] Mon, 20 October 2008 21:01 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
kodos wrote on Mon, 20 October 2008 14:02

Ok, I have tested the new code and it works great so far except that there are no more events on the GLCtrl itself Smile

I have fixed the mouse events with the following code:
virtual Image MouseEvent(int event, Point p, int zdelta, dword keyflags) { return ctrl->MouseEvent(event, p, zdelta, keyflags); }

in the GLPane class. But I haven't found a function like that for the key events, and I don't know if I broke something else Smile


Ops, correct. Hopefuly fixed (check soon). (You forget to translate for view offset, BTW...)

I think keyboard input can be effectively solved by adding "NoWantFocus" to GLPane constructor (there is no way how GLPane could get focus after that point...).

Mirek
Re: More GLCtrl [message #18781 is a reply to message #18776] Mon, 20 October 2008 22:17 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
luzr wrote on Mon, 20 October 2008 20:51

mdelfede wrote on Mon, 20 October 2008 08:26

luzr wrote on Sun, 19 October 2008 18:20

I believe all should be fix now.

Note: DHCtrl was never intended to have children... Therefore, rather than rewriting half of CtrlCore, I have solved the issue by restructruing GLCtrl - it has now DHCtrl as child (and derives from ParentCtrl).

Thanks for hint and a quality testcase - I have put it to upptst for further use Wink

Mirek


Eh, do you remember when some monthes ago I told you CtrlCore would need some strong refactoring ? Smile
Writing Linux GLCtrl was a nightmare because of the impossibility of having childs of windowed controls.



IMO you do not really appreciate nightmares if it would actually be directly possible....

Quote:


But I agree with you, it would be a *big* effort to clean up CtrlCore classes.



IMO, worst thing is that it would be *wrong* effort.

Most of complication in CtrlCore are caused by necessary "impedance mismatch" between U++ and underlaying host system API. "clean up" would most likely produced code that is nice, but does not work. Making it work would then bring us to the current status again...

Mirek


Well.... I'd not call it a "wrong" effort. It would make control behaviour more uniform between windowed and non-windowed controls, from the user's point of view.
BTW, by now it's not a big concern, being GLCtrl the only windowed child control in UPP... but it can change in future Smile
IMHO to have the "correct" behaviour is not impossible, but it does indeed require some work, which maybe isn't worth the effort at the moment.

Max

Re: More GLCtrl [message #19004 is a reply to message #18650] Tue, 04 November 2008 20:13 Go to previous messageGo to next message
kodos is currently offline  kodos
Messages: 111
Registered: March 2008
Experienced Member
Hi,

I have refactored the GLCtrl a little bit so that the platform specific code is just in the GLPane and not in GLCtrl class. I have also fixed a bug on Linux with the resize event not being fired.
While debugging this problem I have found that the methods AfterTerminate and Resize from the linux DHCtrl are never actually called. I think we should remove them.
  • Attachment: GLCtrl.zip
    (Size: 5.48KB, Downloaded 242 times)

[Updated on: Tue, 04 November 2008 20:18]

Report message to a moderator

Re: More GLCtrl [message #19008 is a reply to message #19004] Wed, 05 November 2008 08:53 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Thanks, applied.

Mirek
Re: More GLCtrl [message #19054 is a reply to message #18650] Fri, 07 November 2008 22:43 Go to previous messageGo to next message
cocob is currently offline  cocob
Messages: 156
Registered: January 2008
Experienced Member
I have always some problems with GLCtrl on windows vista

Its ok on Linux32 Linux64 ans winXP
but on vista in all build mode (excepted debug) with MSC9 and MINGW
the refresh() call seems to not work properly.

Unfortunatly i didn't managed to create a small test-case.

cocob
Re: More GLCtrl [message #19055 is a reply to message #18650] Fri, 07 November 2008 23:06 Go to previous messageGo to next message
kodos is currently offline  kodos
Messages: 111
Registered: March 2008
Experienced Member
Hm, I develop on Vista and I don't see a problem with refresh(). Are you sure you use the latest svn uppsrc?
Re: More GLCtrl [message #19060 is a reply to message #18650] Sat, 08 November 2008 10:23 Go to previous messageGo to next message
cocob is currently offline  cocob
Messages: 156
Registered: January 2008
Experienced Member
Yes it is the last svn build (589). There is no problems for me on opengl reference exemple, but with my app recently build for the first time on vista. (no problems on other platforms or in vista in debug mode). How can i debug the refreshing process ?
Re: More GLCtrl [message #19062 is a reply to message #18650] Sat, 08 November 2008 12:31 Go to previous messageGo to next message
cocob is currently offline  cocob
Messages: 156
Registered: January 2008
Experienced Member
it looks like a non-initialized variable (because it works in debug mode) But i can't find it...

The most surprising is that now it works with MINGW, but with MSC9 i have always the problem
cocob

[Updated on: Sat, 08 November 2008 12:34]

Report message to a moderator

Re: More GLCtrl [message #19065 is a reply to message #19054] Sat, 08 November 2008 14:29 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
cocob wrote on Fri, 07 November 2008 16:43

I have always some problems with GLCtrl on windows vista

Its ok on Linux32 Linux64 ans winXP
but on vista in all build mode (excepted debug) with MSC9 and MINGW
the refresh() call seems to not work properly.

Unfortunatly i didn't managed to create a small test-case.

cocob


You can always create a huge one Smile

Mirek
Re: More GLCtrl [message #19079 is a reply to message #18650] Mon, 10 November 2008 15:02 Go to previous messageGo to next message
cocob is currently offline  cocob
Messages: 156
Registered: January 2008
Experienced Member
After some investigations, The bug is present on all windows plateform with all compilers. And it was working with an old version of GLCtrl. I will try to find the modification in svn

[Updated on: Mon, 10 November 2008 15:03]

Report message to a moderator

Re: More GLCtrl [message #19080 is a reply to message #18650] Mon, 10 November 2008 15:48 Go to previous messageGo to previous message
cocob is currently offline  cocob
Messages: 156
Registered: January 2008
Experienced Member
I have solved my problem by adding
virtual void Refresh() { pane.Refresh(); }


In GLCtrl class. But i don't know why this is necessary.

cocob
Previous Topic: why not state oriented?
Next Topic: Writes to freed blocks detected
Goto Forum:
  


Current Time: Thu Mar 28 17:08:47 CET 2024

Total time taken to generate the page: 0.02016 seconds