← Back to team overview

kicad-developers team mailing list archive

Re: Opengl issues after commit 6912/6913

 

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.  

-- 
"Violence is the last refuge of the incompetent." - Isaac Asimov

> On Jun 11, 2016, at 1:32 PM, Chris Pavlina <Pavlina.Chris@xxxxxxxxx> wrote:
> 
> I have another issue with 6912 and I'm not sure if it's related. On my OSX box,
> the OpenGL canvas cannot be resized larger as of this revision - the actual
> active size is 'stuck' at what the application opened at, and any extra space
> is filled with flickering graphical garbage.
> 
> This only seems to happen on my OSX box, not on Linux (haven't tested on
> Windows).
> 
> Confirmed by bisection to be precisely 6912/5850b1c that introduced this.
> 
> Application: pcbnew
> Version: (2016-06-10 BZR 6911, Git 5ce4abd)-product, debug build
> Libraries: wxWidgets 3.0.2
>           libcurl/7.43.0 SecureTransport zlib/1.2.5
> Platform: Mac OS X (Darwin 15.5.0 x86_64), 64 bit, Little endian, wxMac
> - Build Info -
> wxWidgets: 3.0.2 (UTF-8,STL containers,compatible with 2.8)
> Boost: 1.60.0
> Curl: 7.43.0
> KiCad - Compiler: Clang 7.3.0 with C++ ABI 1002
>        Settings: USE_WX_GRAPHICS_CONTEXT=ON
>                  USE_WX_OVERLAY=ON
>                  KICAD_SCRIPTING=OFF
>                  KICAD_SCRIPTING_MODULES=OFF
>                  KICAD_SCRIPTING_WXPYTHON=OFF
>                  USE_FP_LIB_TABLE=HARD_CODED_ON
>                  BUILD_GITHUB_PLUGIN=ON
> 
> 
> On Fri, Jun 10, 2016 at 07:20:16PM +0200, jp charras wrote:
>> Hi, Orson,
>> 
>> I have a new issue after commit 6912/6913:
>> I can switch from legacy to opengl canvas or cairo canvas, but once I have switched from opengl to
>> cairo, I cannot switch to opengl:
>> the error message is
>> Couldn't create OpenGL context and the next message: Requested texture size is not supported.
>> 
>> The first time I start Opengl canvas, I do not have the problem.
>> 
>> This is only after the Opengl canvas is deleted (when switching to cairo) I see this issue, when I
>> try to switch again to Opengl.
>> 
>> Moreover, if I open and close the 3D viewer, and switch from Opengl to cairo canvas (or if I close
>> Kicad), Pcbnew crashes (I am guessing when the Opengl canvas is deleted).
>> 
>> Before these commits, all worked fine for me (W7, 32 bits)
>> In fact I have an issue similar to the previous opengl issue (before ref 6888) .
>> 
>> Sorry, Orson.
>> 
>> -- 
>> Jean-Pierre CHARRAS
>> 
>> _______________________________________________
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help   : https://help.launchpad.net/ListHelp
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp



Follow ups

References