Home » U++ Library support » U++ Library : Other (not classified elsewhere) » [Proposal] Adding a GLLock struct to GLCtrl
Re: [Proposal] Adding a GLLock struct to GLCtrl [message #54713 is a reply to message #54712] |
Thu, 03 September 2020 00:37   |
 |
Klugier
Messages: 1099 Registered: September 2012 Location: Poland, Kraków
|
Senior Contributor |
|
|
Hello Xemuth,
From my point of view the idea of "locking" looks reasonable. However, we should make it more smarter. Please noticed that the API we commit will be with us for the very long time. So, we need to be careful here. All we need to do is make context current and release it at the end of the block. So, I would suggest adding three dedicated methods to context attaching/activating GLCtrl and buffer swapping:
- ActivateContext(); (Anyway void ActivateContext(); from Win32 GLPane seems unimplemented)
- DeactivateContext();
- SwapBuffers();
So, in your case the logic will look as follow:
canvas.ActivateContext();
//Shaders Stuff
//OpenGL buffer filling and loading
canvas.SwapBuffers();
canvas.DeactivateContext();
// All these method will be proxy and send work to GLPane's classes.
return true;
In case of simplification we should add lock mechanisms as you suggested (The three above method should still be available, so you will have a choice):
GLCtrl::ContextLock __(canvas); // <- If this is nested glass GL prefix is redundant.
// Do we always want buffer swpaing if not I would see additional lock...
GLCtrl::ContextLockWithSwapBuffers __(canvas); // <- Alternatively ContextLock can have additional bool parameter (true by default),
// however according to the clean code bool parameter should be avoided, so I
// use more verbose notation here.
We also need documentation for GLCtrl and it seems that Copying file is missing too. Mirek can we add the second file?
Klugier
U++ - one framework to rule them all.
[Updated on: Thu, 03 September 2020 00:39] Report message to a moderator
|
|
|
 |
|
[Proposal] Adding a GLLock struct to GLCtrl
By: Xemuth on Wed, 02 September 2020 18:55
|
 |
|
Re: [Proposal] Adding a GLLock struct to GLCtrl
By: Klugier on Thu, 03 September 2020 00:37
|
 |
|
Re: [Proposal] Adding a GLLock struct to GLCtrl
By: Xemuth on Thu, 03 September 2020 02:30
|
 |
|
Re: [Proposal] Adding a GLLock struct to GLCtrl
By: mirek on Thu, 03 September 2020 09:51
|
 |
|
Re: [Proposal] Adding a GLLock struct to GLCtrl
By: Xemuth on Thu, 03 September 2020 17:21
|
 |
|
Re: [Proposal] Adding a GLLock struct to GLCtrl
By: Klugier on Thu, 03 September 2020 23:46
|
 |
|
Re: [Proposal] Adding a GLLock struct to GLCtrl
By: Xemuth on Fri, 04 September 2020 16:34
|
 |
|
Re: [Proposal] Adding a GLLock struct to GLCtrl
By: Klugier on Fri, 04 September 2020 22:28
|
 |
|
Re: [Proposal] Adding a GLLock struct to GLCtrl
By: Xemuth on Sat, 05 September 2020 15:39
|
 |
|
Re: [Proposal] Adding a GLLock struct to GLCtrl
By: koldo on Wed, 09 September 2020 08:15
|
 |
|
Re: [Proposal] Adding a GLLock struct to GLCtrl
By: koldo on Wed, 09 September 2020 20:41
|
 |
|
Re: [Proposal] Adding a GLLock struct to GLCtrl
By: Klugier on Wed, 09 September 2020 21:25
|
 |
|
Re: [Proposal] Adding a GLLock struct to GLCtrl
By: Xemuth on Thu, 10 September 2020 16:52
|
Goto Forum:
Current Time: Mon Apr 28 20:48:37 CEST 2025
Total time taken to generate the page: 0.00998 seconds
|