← Back to team overview

kicad-developers team mailing list archive

Re: Opengl issues after commit 6912/6913

 

On 06/13/2016 01:58 AM, Collin Anderson wrote:
> This same behavior occurs on my OS X box as well.  It also has coordinate transformation issues if you try to lower the size of the window.  Here, rather than try and describe it, here is a gif (frame rate is low in the gif, it is not choppy in reality): https://metacollin.com/resize.gif 
> 
> I have been using OpenGL for years with limited success ( old but probably best demo that I may, in fact, not be full of crap ;)  https://www.youtube.com/watch?v=SGddIJBAEUk ) and I've been glancing at the code for anything obvious, and I did find one problem:
> 
> In the constructor for OPENGL_GAL:
> 
>   if( glMainContext == NULL )
>     {
>         glMainContext = GL_CONTEXT_MANAGER::Get().CreateCtx( this );
>         glPrivContext = glMainContext;
>         shader = new SHADER();
>     }
>     else
>     {
>         glPrivContext = GL_CONTEXT_MANAGER::Get().CreateCtx( this, glMainContext );
>     }
> 
> 
> This looks dangerous.  I might be wrong, KiCad's code base is ....non-trivial :).  So maybe there is no problem here, but if glMainContext is not NULL, is it guaranteed to be 'virgin' at this point? OpenGL contexts must be totally fresh when they are shared - you cannot make any opengl calls in any context until after you've created a shared context (if you are going to).  In other words, one would be expected to call the function that ultimately creates a new context that is shared with another one immediately after that other one has been created.  
> 
> i.e. 
> 
>  glMainContext = GL_CONTEXT_MANAGER::Get().CreateCtx( this ); // the main context
>  glPrivContext = GL_CONTEXT_MANAGER::Get().CreateCtx( this, glMainContext ); // Must create your shared context immediately after, before any OpenGL calls are made to the main context
> 
> Again, maybe that is exactly what will ultimately happen, I didn't get a chance to look at the higher level code to check.  Hopefully someone who knows what is going on can say for sure though. 
> 
> Anyway, I'll keep going through the code as time permits, at least while things are still broken OpenGLwise.  

Hi Collin,

I may modify the code to assure that contexts are shared in the way you
describe, but would you point me to a relevant documentation that says
so? I have grepped the OpenGL 2.1 specification [1] with 'shar' and
'context' and I could not find any notice that requires the main context
to be untouched before another shared context is created.

Thank you in advance,
Orson

1. https://www.opengl.org/registry/doc/glspec21.20061201.pdf

Attachment: signature.asc
Description: OpenPGP digital signature


References