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 #53133 is a reply to message #53125] |
Fri, 06 March 2020 10:28 |
|
mirek
Messages: 13975 Registered: November 2005
|
Ultimate Member |
|
|
Xemuth wrote on Wed, 04 March 2020 13:28mirek 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 !
For I prefer it to stay as it is....
|
|
|
Goto Forum:
Current Time: Fri Mar 29 08:02:49 CET 2024
Total time taken to generate the page: 0.02297 seconds
|