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 |
|
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 :
|
|
|
|
|
[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: Fri Nov 01 00:15:59 CET 2024
Total time taken to generate the page: 0.02615 seconds
|