Home » U++ Library support » U++ Widgets - General questions or Mixed problems » [GLCtrl] Adding an Initilisation function to GLPaint
Re: [GLCtrl] Adding an Initilisation function to GLPaint [message #53125 is a reply to message #53124] |
Wed, 04 March 2020 13:28   |
 |
Xemuth
Messages: 387 Registered: August 2018 Location: France
|
Senior Member |
|
|
mirek wrote on Wed, 04 March 2020 13:06I think the problem is that context is created but not associated with current thread.
Try with ExecuteGL method...
Hello Mirek, you are right, doing this kind of thing work :
void GLCtrl::GLPane::ExecuteGL(HDC hDC, Event<> paint, bool swap_buffers)
{
static bool HaveBeenInitialised = false;
wglMakeCurrent(hDC, s_openGLContext);
if(!HaveBeenInitialised){
static_cast<GLCtrl*>(parent)->Initialisation();//--> I call Initialisation Here
HaveBeenInitialised = true;
}
paint();
if(swap_buffers)
SwapBuffers(hDC);
else
glFlush();
wglMakeCurrent(NULL, NULL);
}
mirek wrote on Wed, 04 March 2020 13:06That said, doing this in GLPaint actually seems fine to me.
Yes, it work aswell but the idea of having a visible boolean just to do some action at the first loop of drawing is disturbing me (the fix I did in ExecuteGL(...) is basicly the same things but user don't see it Is it possible to add it to the GLCtrl code or you prefer stay like that ?
Thanks in advance
Best regard !
|
|
|
Goto Forum:
Current Time: Tue Apr 29 05:57:53 CEST 2025
Total time taken to generate the page: 0.03560 seconds
|