コード例 #1
0
        public static void SetDimensions(IntPtr deviceContext, int width, int height)
        {
            SoftGLDeviceContext dc = SoftGLDeviceContext.FromHandle(deviceContext);

            if (dc != null)
            {
                dc.SetDimensions(width, height);
            }
        }
コード例 #2
0
        internal static SoftGLDeviceContext FromHandle(IntPtr handle)
        {
            SoftGLDeviceContext result = null;

            if (!handleDeviceDict.TryGetValue(handle, out result))
            {
                result = null;
            }

            return(result);
        }
コード例 #3
0
        /// <summary>
        /// Make specified <paramref name="renderContext"/> the current one of current thread.
        /// </summary>
        /// <param name="deviceContext"></param>
        /// <param name="renderContext"></param>
        public static void MakeCurrent(IntPtr deviceContext, IntPtr renderContext)
        {
            SoftGLRenderContext context = GetContextObj(renderContext);
            var  device     = SoftGLDeviceContext.FromHandle(deviceContext);
            bool firstBound = ((context != null) && (device != null) && (!context.Bounded));

            ContextManager.MakeCurrent(deviceContext, renderContext);

            if (firstBound)
            {
                int x = 0, y = 0, width = device.Width, height = device.Height;
                SoftGLRenderContext.glViewport(x, y, width, height);
            }
        }
コード例 #4
0
        public static IntPtr CreateDeviceContext(int width, int height)
        {
            var dc = new SoftGLDeviceContext(width, height);

            return(dc.DeviceContextHandle);
        }