← Back to team overview

kicad-developers team mailing list archive

Re: mode openGL issues after latest updates

 

Hi Mario,

On 06/08/2016 08:09 PM, Mário Luzeiro wrote:
> Hi Orson,
> 
> I am back on testing this openGL issues.
> I implemented your context manager in my branch.
> It looks good the implementation (still need a bit style clean up your source code file, eg: gl_context_mgr.cpp line 86)
> 
> I didn't tried it properly on Windows yet.
> I am debugging (on debug mode) it on Linux.
> 
> Running in debug mode, the only issue that remains is the one with the windows is not visible when the context is set.
> For instance, now every time I run pcbnew in debug more, just open and close it will make an ASSERT while closing the GAL.
> The windows is probably already gone at that time..
> 
> I also having some difficulties in the module editor.
> I implemented on my branch a object->close(); feature so I can try early to destroy the context, hopefully while the windows is still visible.
> I found for example if I close the windows (of module editor) by pressing X it will follow a path.. if I close is by "Cancel" it will follow other path.. 
> So this get difficult to solve..
> 
> Anyway, some of this issues now are in the end to try to destroy the context because using your lock feature, it is trying to set the context always. (Before that was not true, or we implemented it different for Linux vs Windows)
> 
> I have one suggestion for your context manager.
> In the lock, maybe we can try to set the context just if it changed.
> 
> From our experience and from the wxwidget (opengl) samples, they delete the context without set it.
> I also found this on some samples, on the OnPaint event:
>     // This is normally only necessary if there is more than one wxGLCanvas
>     // or more than one wxGLContext in the application.
>     SetCurrent(*m_glRC);
> 
> So it may mean that the SetCurrent does not need to take place on all paint events.
> Also, in the end, when destroy it, if it didn't change, there is no need to SetCurrent again and it will not ASSERT .. (if the context didn't change.. so I expect that it is still on a valid state and can be used..)

I may try it, as the idea seems right overall, but I feel it is not the
ultimate solution. Remember that I have implemented the context locking,
because we had issues caused by the fact that another window has changed
the GL context before the destructor was called.

If I call SetCurrent() only when the current context is different than
the requested one, I will still need to change the current context if
another window has changed in the time period between closing window and
calling its destructor. It means that we will still get occasional
asserts, even though things work fine.

In wxWidgets examples they do not need to set context, as there is only
one, so there is no chance OpenGL calls might be invoked in a wrong context.

BTW. I do not see the asserts, I am wondering if there is a better
implementation in newer wxWidgets. Which version do you use?

Regards,
Orson

> Hope you can have a thought about this.. cheers!
> 
> Regards,
> Mario Luzeiro
> 

Attachment: signature.asc
Description: OpenPGP digital signature


Follow ups

References