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) » [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 Go to previous messageGo to previous message
Klugier is currently offline  Klugier
Messages: 1076
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

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Changing default standard from c++14 to c++17 (2020.2 Release)
Next Topic: RegExp
Goto Forum:
  


Current Time: Mon Apr 29 17:48:09 CEST 2024

Total time taken to generate the page: 0.02453 seconds