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 #54775 is a reply to message #54771] Thu, 10 September 2020 16:52 Go to previous message
Xemuth is currently offline  Xemuth
Messages: 387
Registered: August 2018
Location: France
Senior Member
Hello Klugier !

I then propose this integration :


struct GLLock{
	private:
		GLCtrl& ctrl;
		bool swap;
	public:
		GLLock(GLCtrl& glCtrl, bool swapBuffer = false);
		~GLLock();
};

class GLCtrl : public Ctrl {
	typedef GLCtrl CLASSNAME;
	friend class GLLock;
//*************************
//}


with for Win32GLCtrl.cpp :
GLLock::GLLock(GLCtrl& glCtrl, bool swapBuffer) : ctrl(glCtrl), swap(swapBuffer)
{
	HWND hwnd = ctrl.pane.GetHWND();
	HDC hDC = GetDC(hwnd);
	wglMakeCurrent(hDC, s_openGLContext);
}

GLLock::~GLLock()
{
	if(swap){
		HWND hwnd = ctrl.pane.GetHWND();
		HDC hDC = GetDC(hwnd);
		SwapBuffers(hDC);
	}else{
		glFlush();
	}
	wglMakeCurrent(NULL, NULL);
}


and for XGLCtrl.cpp :
GLLock::GLLock(GLCtrl& glCtrl, bool swapBuffer) : ctrl(glCtrl), swap(swapBuffer)
{
	glXMakeCurrent(s_Display, ctrl.win, s_GLXContext);
}

GLLock::~GLLock()
{
	if(swap){
		glXSwapBuffers(s_Display, win);
	}else{
		glFlush();
	}
	glXMakeCurrent(s_Display, None, NULL);
}


Here is diff file :
 
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 15:36:26 CEST 2024

Total time taken to generate the page: 0.03811 seconds