Jump to content
  • Advertisement
Sign in to follow this  

Display List and gl shared context

This topic is 3125 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I have do a small change to my application, now I share the context by using this call :
GlContextManager.ShareContext(Wgl.wglGetCurrentContext());
It work really fine, I use textures, VBO ... all is nice... But when I try to use DisplayLists, I got a "Attempted to read or write protected memory" !!! It crash when I call glCallList... even if it is the very first call to this method !!!
            _listId = Gl.glGenLists(1);
            Gl.glNewList(_listId, Gl.GL_COMPILE);

            renderAction();

            Gl.glEndList();

            Gl.glCallList(_listId);
Here is the GlContextManager class
    static public class GlContextManager
    {

        #region Variables

        static private List<IntPtr> _contexts = new List<IntPtr>();

        #endregion

        #region ShareContext

        /// <summary>
        /// Share this context with all the other ones.
        /// </summary>
        static public void ShareContext(IntPtr context)
        {
            if (_contexts.Contains(context))
                return;

            for (int i = 0; i < _contexts.Count; i++)
            {
                bool r = Wgl.wglShareLists(_contexts, context);
            }

            _contexts.Add(context);
        }

        #endregion

    }
Does someone has an idea of the problem ? Thanks for your help

Share this post


Link to post
Share on other sites
Advertisement
Finally I have remove the following line :
Gl.glClientActiveTexture(Gl.GL_TEXTURE2)

and it works... hum , no more crash

But I can't see my textures !!!

I have just do this :

Gl.glTexCoordPointer(2, Gl.GL_DOUBLE, Vertex.SIZEOF, (IntPtr)(6 * sizeof(double)));

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!