Example #1
0
        public GlPlatformFeature(IAvnGlDisplay display)
        {
            _display = display;
            var immediate = display.CreateContext(null);
            var deferred  = display.CreateContext(immediate);


            int         major, minor;
            GlInterface glInterface;

            using (immediate.MakeCurrent())
            {
                var basic = new GlBasicInfoInterface(display.GetProcAddress);
                basic.GetIntegerv(GlConsts.GL_MAJOR_VERSION, out major);
                basic.GetIntegerv(GlConsts.GL_MINOR_VERSION, out minor);
                _version    = new GlVersion(GlProfileType.OpenGL, major, minor);
                glInterface = new GlInterface(_version, (name) =>
                {
                    var rv = _display.GetProcAddress(name);
                    return(rv);
                });
            }

            GlDisplay = new GlDisplay(display, glInterface, immediate.SampleCount, immediate.StencilSize);

            ImmediateContext = new GlContext(GlDisplay, immediate, _version);
            DeferredContext  = new GlContext(GlDisplay, deferred, _version);
        }
 public GlDisplay(IAvnGlDisplay display)
 {
     _display    = display;
     GlInterface = new GlInterface((name, optional) =>
     {
         var rv = _display.GetProcAddress(name);
         if (rv == IntPtr.Zero && !optional)
         {
             throw new OpenGlException($"{name} not found in system OpenGL");
         }
         return(rv);
     });
 }
Example #3
0
 public GlDisplay(IAvnGlDisplay display, int sampleCount, int stencilSize)
 {
     _display    = display;
     SampleCount = sampleCount;
     StencilSize = stencilSize;
     GlInterface = new GlInterface((name, optional) =>
     {
         var rv = _display.GetProcAddress(name);
         if (rv == IntPtr.Zero && !optional)
         {
             throw new OpenGlException($"{name} not found in system OpenGL");
         }
         return(rv);
     });
 }