public static void SetDimensions(IntPtr deviceContext, int width, int height) { SoftGLDeviceContext dc = SoftGLDeviceContext.FromHandle(deviceContext); if (dc != null) { dc.SetDimensions(width, height); } }
internal static SoftGLDeviceContext FromHandle(IntPtr handle) { SoftGLDeviceContext result = null; if (!handleDeviceDict.TryGetValue(handle, out result)) { result = null; } return(result); }
/// <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); } }
public static IntPtr CreateDeviceContext(int width, int height) { var dc = new SoftGLDeviceContext(width, height); return(dc.DeviceContextHandle); }