1 Reply Latest reply on May 18, 2014 1:48 AM by nou

    VAO cannot be shared between contexts ?

    cippyboy

      While creating a core context I noticed that after calling wglShareLists Vertex Array Objects Names start with 1 again.

       

      UINT GlobalVAO[ 2 ] = { 0 };

                  if ( 1 )

                  {              

                      glGenVertexArrays( 1, &GlobalVAO[ 0 ] );

                

                      glBindVertexArray( GlobalVAO[ 0 ] );

                    

                  }

                  int attriblist[] = {

                      WGL_CONTEXT_MAJOR_VERSION_ARB, 4,

                      WGL_CONTEXT_MINOR_VERSION_ARB, 2,//returns 4.4 anyway!

                      WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB,//WGL_CONTEXT_DEBUG_BIT_ARB,

                      WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,

                      0, 0 };

                  HGLRC NewGLC = wglCreateContextAttribsARB( hdc, NULL, attriblist );

                

                  BOOL Shared = wglShareLists( hrc, NewGLC );// hrc comes from a call to hrc = wglCreateContext( Window_hdc );

               

                  if (NewGLC)

                  {

                      wglMakeCurrent( hdc, NewGLC );

                   

                  }

             

                  if (  1 )

                  {              

                      glGenVertexArrays( 1, &GlobalVAO[ 1 ] );

       

                      glBindVertexArray( GlobalVAO[ 1 ] );

       

                  }

      if ( GlobalVAO[ 0 ] == GlobalVAO[ 1 ])//always returns true

      {

       

      }

        • Re: VAO cannot be shared between contexts ?
          nou

          no they are not shared. refer to chapter 2.6.10 of OpenGL 4.4 core specification.

           

          what is shared are shaders, programs, textures, buffers, samplers, renderbuffers, sync objects. FBO are shared only when created through EXT version of extension. ARB version FBO are NOT shared. if you mix EXT and ARB version of FBO functions it can lead to undefined behavior.