cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

cippyboy
Journeyman III

VAO cannot be shared between contexts ?

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

{

}

0 Likes
1 Reply
nou
Exemplar

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.

0 Likes