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 #54715 is a reply to message #54712] Thu, 03 September 2020 09:51 Go to previous messageGo to previous message
mirek is currently online  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Xemuth wrote on Wed, 02 September 2020 18:55
Hello, with the new version of Glew I moved my application to GLCtrl.
However, in many part of my application, I need to get the OpenGL context to perform many actions. The actual way of executing something in the good OpenGL Context is to call ExecuteGL(Event<> paint, bool swap_buffers). Which force me to surround my code arround this function. It work but not convenient and for some part it block me and force me to change my architecture.

Here is a trivial exemple of how to use it :
	bool LoadSTL(){ //This function is used when a button is pressed
		try {
			GLCtrl::GLLock __(canvas); //Canvas is the GLCtrl object
			//Shaders Stuff
			//OpenGL buffer filling and loading 
			//Definition of draw
			return true;
		} catch (Exc e) {
			Exclamation(DeQtf(e));
		}
		return false;
	}






I am not against, but in the example you have posted this does not really feel like improvement...

	bool LoadSTL(){ //This function is used when a button is pressed
		try {
                        canvas.ExecuteGL([&] {
			 //OpenGL buffer filling and loading 
			 //Definition of draw
                        });
			return true;
		} catch (Exc e) {
			Exclamation(DeQtf(e));
		}
		return false;
	}
 
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 11:53:49 CEST 2024

Total time taken to generate the page: 0.02932 seconds