This project is read-only.


Jan 13, 2012 at 5:10 PM

I want to use the wglShareLists Windows call and noticed it is missing from SharpGL. Is this intentional or an oversight? I added the wrapper for it to SharpGL and am trying to get it to work, so far without much success, so I thought I'd ask if there are known issues using wglShareLists with SharpGL

Here is the code I added to Win32.cs :

        /// <summary>
        /// Link two render contexts so they share lists (buffer IDs, etc.)
        /// </summary>
        /// <param name="hrc1">The first context.</param>
        /// <param name="hrc2">The second context.</param>
        /// <returns>If the function succeeds, the return value is TRUE. If the function fails, the return value is FALSE. To get extended error information, call GetLastError.</returns>
        [DllImport(OpenGL32, SetLastError = true)]
        public static extern bool wglShareLists(IntPtr hrc1, IntPtr hrc2);

Jan 14, 2012 at 5:35 PM

OK, I found a way where wglShareLists seems to work. I need to call it from the thread that has the "master" context, and the other context must not be current in its thread. This exposed a small problem: I didn't see any way to make nothing current in SharpGL. Since I didn't want to make a dummy context to make current while I execute the wglShareLists, I add the following entry point to SharpGL.OpenGL in OpenGL.cs:

        /// <summary>
        /// Makes no render context current.
        /// </summary>
        public void MakeNothingCurrent()
            Win32.wglMakeCurrent(IntPtr.Zero, IntPtr.Zero);

Jan 16, 2012 at 4:52 PM

mbraca - thanks for letting me know about this, I will make these changes in the main codebase as mentioned in the issue:

Changes will go in shortly :)