public override IGraphicsContext CreateGLContext(ContextHandle handle, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags) { WinWindowInfo win_win = (WinWindowInfo)window; IntPtr egl_display = GetDisplay(win_win.DeviceContext); EglWindowInfo egl_win = new OpenTK.Platform.Egl.EglWindowInfo(win_win.WindowHandle, egl_display); return new EglContext(handle, egl_win, shareContext, major, minor, flags); }
public override void Draw( IWindowInfo info, Bitmap framebuffer ) { using( FastBitmap bmp = new FastBitmap( framebuffer, true ) ) { IntPtr scan0 = bmp.Scan0; int size = bmp.Width * bmp.Height * 4; IntPtr colorSpace = OSX.API.CGColorSpaceCreateDeviceRGB(); IntPtr provider = OSX.API.CGDataProviderCreateWithData( IntPtr.Zero, scan0, size, IntPtr.Zero ); const uint flags = 4 | (2 << 12); IntPtr image = OSX.API.CGImageCreate( bmp.Width, bmp.Height, 8, 8 * 4, bmp.Stride, colorSpace, flags, provider, IntPtr.Zero, 0, 0 ); IntPtr context = IntPtr.Zero; OSStatus err = OSX.API.QDBeginCGContext( windowPort, ref context ); OSX.API.CheckReturn( err ); OSX.HIRect rect = new OSX.HIRect(); rect.Origin.X = 0; rect.Origin.Y = 0; rect.Size.X = bmp.Width; rect.Size.Y = bmp.Height; OSX.API.CGContextDrawImage( context, rect, image ); OSX.API.CGContextSynchronize( context ); err = OSX.API.QDEndCGContext( windowPort, ref context ); OSX.API.CheckReturn( err ); OSX.API.CGImageRelease( image ); OSX.API.CGDataProviderRelease( provider ); OSX.API.CGColorSpaceRelease( colorSpace ); } }
public X11Input(IWindowInfo attach) { if (attach == null) throw new ArgumentException("A valid parent window must be defined, in order to create an X11Input driver."); X11WindowInfo x11WindowInfo = (X11WindowInfo) attach; this.mouse.Description = "Default X11 mouse"; this.mouse.DeviceID = IntPtr.Zero; this.mouse.NumberOfButtons = 5; this.mouse.NumberOfWheels = 1; this.dummy_mice_list.Add(this.mouse); using (new XLock(x11WindowInfo.Display)) { API.DisplayKeycodes(x11WindowInfo.Display, ref this.firstKeyCode, ref this.lastKeyCode); IntPtr keyboardMapping = API.GetKeyboardMapping(x11WindowInfo.Display, (byte) this.firstKeyCode, this.lastKeyCode - this.firstKeyCode + 1, ref this.keysyms_per_keycode); this.keysyms = new IntPtr[(this.lastKeyCode - this.firstKeyCode + 1) * this.keysyms_per_keycode]; Marshal.PtrToStructure(keyboardMapping, (object) this.keysyms); API.Free(keyboardMapping); KeyboardDevice keyboardDevice = new KeyboardDevice(); this.keyboard.Description = "Default X11 keyboard"; this.keyboard.NumberOfKeys = this.lastKeyCode - this.firstKeyCode + 1; this.keyboard.DeviceID = IntPtr.Zero; this.dummy_keyboard_list.Add(this.keyboard); bool supported; Functions.XkbSetDetectableAutoRepeat(x11WindowInfo.Display, true, out supported); } }
private void InitGL() { windowInfo = Utilities.CreateWindowsWindowInfo(window.Handle); context = new GraphicsContext(GraphicsMode.Default, windowInfo); context.MakeCurrent(windowInfo); context.LoadAll(); }
internal iPhoneOSGraphicsContext(ContextHandle handle, IWindowInfo window, IGraphicsContext sharedContext, int major, int minor, GraphicsContextFlags flags) { // ignore mode, window iPhoneOSGraphicsContext shared = sharedContext as iPhoneOSGraphicsContext; EAGLRenderingAPI version = 0; if (major == 1 && minor == 1) version = EAGLRenderingAPI.OpenGLES1; else if (major == 2 && minor == 0) version = EAGLRenderingAPI.OpenGLES2; else if (major == 3 && minor == 0) version = EAGLRenderingAPI.OpenGLES3; else throw new ArgumentException (string.Format("Unsupported GLES version {0}.{1}.", major, minor)); if (handle.Handle == IntPtr.Zero) { EAGLContext = shared != null && shared.EAGLContext != null ? new EAGLContext(version, shared.EAGLContext.ShareGroup) : new EAGLContext(version); contextHandle = new ContextHandle(EAGLContext.Handle); } else { EAGLContext = (EAGLContext) Runtime.GetNSObject (handle.Handle); contextHandle = handle; } }
public override IGraphicsContext CreateGLContext(ContextHandle handle, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags) { WinWindowInfo winWindowInfo = (WinWindowInfo) window; IntPtr display = this.GetDisplay(winWindowInfo.DeviceContext); EglWindowInfo window1 = new EglWindowInfo(winWindowInfo.WindowHandle, display); return (IGraphicsContext) new EglContext(handle, window1, shareContext, major, minor, flags); }
public override OpenTK.Graphics.IGraphicsContext CreateGLContext( GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags) { flags |= GraphicsContextFlags.Embedded; return base.CreateGLContext(mode, window, shareContext, directRendering, major, minor, flags); }
public SampleBrowser(Context context, IGraphicsContext graphicsContext, IWindowInfo windowInfo) { // TODO: Complete member initialization this.androidContext = context; this.GLGraphicsContext = graphicsContext; this.GlWindowInfo = windowInfo; }
public static IGraphicsContext CreateGraphicsContext(GraphicsMode mode, IWindowInfo window, int major, int minor, GraphicsContextFlags flags) { GraphicsContext graphicsContext = new GraphicsContext(mode, window, major, minor, flags); graphicsContext.MakeCurrent(window); graphicsContext.LoadAll(); return (IGraphicsContext) graphicsContext; }
public bool OnBeforePopup(IWebBrowser rpBrowserControl, IBlinkBrowser rpBrowser, IFrame rpFrame, string rpTargetUrl, string rpTargetFrameName, WindowOpenDisposition rpTargetDisposition, bool rpUserGesture, IPopupFeatures rpPopupFeatures, IWindowInfo rpWindowInfo, IBrowserSettings rpBrowserSettings, ref bool rrpNoJavascriptAccess, out IWebBrowser ropNewBrowser) { rpBrowserControl.Load(rpTargetUrl); ropNewBrowser = rpBrowserControl; return true; }
public override IGraphicsContext CreateGLContext(ContextHandle handle, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags) { X11WindowInfo x11_win = (X11WindowInfo)window; //EglWindowInfo egl_win = new OpenTK.Platform.Egl.EglWindowInfo(x11_win.WindowHandle, Egl.GetDisplay(x11_win.Display)); EglWindowInfo egl_win = new OpenTK.Platform.Egl.EglWindowInfo(x11_win.WindowHandle, Egl.GetDisplay(new IntPtr(0))); return new EglContext(handle, egl_win, shareContext, major, minor, flags); }
private void Form1_Load(object sender, EventArgs e) { Closing += Form1_Closing; WindowInfo = Utilities.CreateWindowsWindowInfo(panel1.Handle); var WindowMode = new GraphicsMode(32, 24, 0, 0, 0, 2); WindowContext = new GraphicsContext(WindowMode, WindowInfo, 2, 0, GraphicsContextFlags.Debug); WindowContext.MakeCurrent(WindowInfo); WindowContext.LoadAll(); // as IGraphicsContextInternal) WindowContext.SwapInterval = 1; GL.Viewport(0, 0, panel1.Width, panel1.Height); GL.Enable(EnableCap.DepthTest); GL.Disable(EnableCap.CullFace); GL.ClearColor(Color.DarkBlue); try { state.LoadCLRPackage(); state.DoString(@" import ('LUA', 'LUA') "); } catch (LuaException ex) { MessageBox.Show(ex.Message, "LUA Package Exception", MessageBoxButtons.OK); } state["x"] = 0.0; state["y"] = 1.0; state["fn"] = 0; script = textBox1.Text; timer1.Enabled = true; }
public AglContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext) { Debug.Print("Context Type: {0}", shareContext); Debug.Print("Window info: {0}", window); this.graphics_mode = mode; this.carbonWindow = (CarbonWindowInfo)window; if (shareContext is AglContext) shareContextRef = ((AglContext)shareContext).Handle.Handle; if (shareContext is GraphicsContext) { ContextHandle shareHandle = shareContext != null ? (shareContext as IGraphicsContextInternal).Context : (ContextHandle)IntPtr.Zero; shareContextRef = shareHandle.Handle; } if (shareContextRef == IntPtr.Zero) { Debug.Print("No context sharing will take place."); } CreateContext(mode, carbonWindow, shareContextRef, true); }
internal CarbonGLControl(GraphicsMode mode, Control owner) { this.mode = mode; this.control = owner; window_info = Utilities.CreateMacOSCarbonWindowInfo(control.Handle, false, true); }
public X11GLContext(GraphicsMode mode, IWindowInfo window) { if (mode == null) throw new ArgumentNullException("mode"); if (window == null) throw new ArgumentNullException("window"); Debug.Print( "Creating X11GLContext context: " ); currentWindow = (X11WindowInfo)window; Display = API.DefaultDisplay; XVisualInfo info = currentWindow.VisualInfo; Mode = GetGraphicsMode( info ); // Cannot pass a Property by reference. ContextHandle = Glx.glXCreateContext(Display, ref info, IntPtr.Zero, true); if (ContextHandle == IntPtr.Zero) { Debug.Print("failed. Trying indirect... "); ContextHandle = Glx.glXCreateContext(Display, ref info, IntPtr.Zero, false); } if (ContextHandle != IntPtr.Zero) Debug.Print("Context created (id: {0}).", ContextHandle); else throw new GraphicsContextException("Failed to create OpenGL context. Glx.CreateContext call returned 0."); if (!Glx.glXIsDirect(Display, ContextHandle)) Debug.Print("Warning: Context is not direct."); }
bool ILifeSpanHandler.OnBeforePopup(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, string targetFrameName, WindowOpenDisposition targetDisposition, bool userGesture, IPopupFeatures popupFeatures, IWindowInfo windowInfo, IBrowserSettings browserSettings, ref bool noJavascriptAccess, out IWebBrowser newBrowser) { newBrowser = null; //browserControl.Load(targetUrl); OpenInNewTab?.Invoke(this, new NewTabEventArgs(targetUrl)); //this breaks when there are multiple window.open calls from JS. return true; }
public AglContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, GetInt xoffset, GetInt yoffset) { Debug.Print("Share context: {0}", shareContext); Debug.Print("Window info: {0}", window); IntPtr shareContextRef = IntPtr.Zero; XOffset = xoffset; YOffset = yoffset; carbonWindow = window; if (shareContext is AglContext) { shareContextRef = ((AglContext)shareContext).Handle.Handle; } else if (shareContext is GraphicsContext) { ContextHandle shareHandle = shareContext != null ? (shareContext as IGraphicsContextInternal).Context : (ContextHandle)IntPtr.Zero; shareContextRef = shareHandle.Handle; } if (shareContextRef == IntPtr.Zero) { Debug.Print("No context sharing will take place."); } CreateContext(mode, carbonWindow, shareContextRef, true); }
public override IGraphicsContext CreateGLContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags) { WinWindowInfo win_win = (WinWindowInfo)window; EGLDisplay egl_display = Egl.GetDisplay(EGLNativeDisplayType.Default); // Egl.GetDisplay(new EGLNativeDisplayType(win_win.DeviceContext)); EglWindowInfo egl_win = new OpenTK.Platform.Egl.EglWindowInfo(win_win.WindowHandle, egl_display); return new EglContext(mode, egl_win, shareContext, major, minor, flags); }
public AndroidGraphicsContext (GraphicsMode mode, IWindowInfo window, IGraphicsContext sharedContext, int major, int minor, GraphicsContextFlags flags) { if (major < 1 || major > 3) throw new ArgumentException (string.Format("Unsupported GLES version {0}.{1}.", major, minor)); Init (mode, window, sharedContext, major, minor, flags); }
public static IDisposable AcquireContext(IWindowInfo windowInfo = null) { Monitor.Enter(Lock); if (1 == ++ContextReferenceCount.Value) GLGraphicsContext.MakeCurrent(windowInfo ?? GLControl.WindowInfo); return new DisposableAction(FreeContext, true); }
public AglContext(GraphicsMode mode, IWindowInfo window) { Debug.Print("Window info: {0}", window); Mode = mode; this.carbonWindow = (CarbonWindowInfo)window; CreateContext(mode, carbonWindow, true); }
public AglContext(ContextHandle handle, IWindowInfo window, IGraphicsContext shareContext) { if (handle == ContextHandle.Zero) throw new ArgumentException("handle"); if (window == null) throw new ArgumentNullException("window"); this.Handle = handle; this.carbonWindow = (CarbonWindowInfo) window; }
public SDL2GLContext(IntPtr ctxhandle, IWindowInfo windowInfo) { Console.WriteLine("WARNING! Creating context in a way we don't quite understand."); SDL2WindowInfo currentWindow = (SDL2WindowInfo)windowInfo; window = currentWindow.WindowHandle; context = ctxhandle; Handle = new ContextHandle(context); MakeCurrent(windowInfo); }
public OpenGLGraphics(Form form, Common common) { this.form = form; this.common = common; windowInfo = Utilities.CreateWindowsWindowInfo(form.Handle); context = new GraphicsContext(GraphicsMode.Default, windowInfo); context.MakeCurrent(windowInfo); context.LoadAll(); }
public Sdl2GLControl(GraphicsMode mode, Control control) { this.mode = mode; window_info = Utilities.CreateSdl2WindowInfo(control.Handle); // Fixme: SDL2 will refuse to create an OpenGL context on // a window with the SDL_WINDOW_FOREIGN flag (i.e. windows // that are passed to SDL2 through SDL_CreateWindowFrom). // This must be fixed upstream. }
public AglContext(ContextHandle handle, IWindowInfo window, IGraphicsContext shareContext) : base(DesktopBackend.OpenGL) { if (handle == ContextHandle.Zero) throw new ArgumentException("handle"); if (window == null) throw new ArgumentNullException("window"); Handle = handle; carbonWindow = (CarbonWindowInfo)window; }
public CocoaContext(ContextHandle handle, IWindowInfo window, IGraphicsContext shareContext, int majorVersion, int minorVersion) { if (handle == ContextHandle.Zero) throw new ArgumentException("handle"); if (window == null) throw new ArgumentNullException("window"); Handle = handle; cocoaWindow = (CocoaWindowInfo)window; }
public AglContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext) { this.graphics_mode = mode; this.carbonWindow = (CarbonWindowInfo) window; if (shareContext is AglContext) this.shareContextRef = ((GraphicsContextBase) shareContext).Handle.Handle; if (shareContext is GraphicsContext) this.shareContextRef = (shareContext != null ? (shareContext as IGraphicsContextInternal).Context : (ContextHandle) IntPtr.Zero).Handle; int num = this.shareContextRef == IntPtr.Zero ? 1 : 0; this.CreateContext(mode, this.carbonWindow, this.shareContextRef, true); }
public Graphics(IApplicationWindow window) { _window = window; IntPtr handle = _window.GetHandle(); wi = GetWindowInfo(handle); //GraphicsMode graphicsMode = GraphicsMode.Default; GraphicsMode graphicsMode = new GraphicsMode(new ColorFormat(32), 16); _graphicsContext = new GraphicsContext( graphicsMode, wi); }
/// <summary> /// Creates an IGraphicsContext instance for the specified window. /// </summary> /// <param name="mode">The GraphicsMode for the GraphicsContext.</param> /// <param name="window">An IWindowInfo instance describing the parent window for this IGraphicsContext.</param> /// <param name="major">The major OpenGL version number for this IGraphicsContext.</param> /// <param name="minor">The minor OpenGL version number for this IGraphicsContext.</param> /// <param name="flags">A bitwise collection of GraphicsContextFlags with specific options for this IGraphicsContext.</param> /// <returns>A new IGraphicsContext instance.</returns> public static IGraphicsContext CreateGraphicsContext( GraphicsMode mode, IWindowInfo window, int major, int minor, GraphicsContextFlags flags) { GraphicsContext context = new GraphicsContext(mode, window, major, minor, flags); context.MakeCurrent(window); (context as IGraphicsContextInternal).LoadAll(); return context; }
bool IExtensionHandler.OnBeforeBrowser(IExtension extension, IBrowser browser, IBrowser activeBrowser, int index, string url, bool active, IWindowInfo windowInfo, IBrowserSettings settings) { return(false); }
public IGraphicsContext CreateGLContext(ContextHandle handle, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags) { return(default_implementation.CreateGLContext(handle, window, shareContext, directRendering, major, minor, flags)); }
public IGraphicsContext CreateESContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, int major, int minor, GraphicsContextFlags flags) { throw new PlatformNotSupportedException(error_string); }
private static IGraphicsContext PlatformCreateContext(IWindowInfo info) { return(new GraphicsContext(info)); }
public abstract void Resize(IWindowInfo info);
public void PreviewWindowClosed(IWindowInfo window) { // throw new NotImplementedException(); }
bool ILifeSpanHandler.OnBeforePopup(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, string targetFrameName, WindowOpenDisposition targetDisposition, bool userGesture, IWindowInfo windowInfo, ref bool noJavascriptAccess, out IWebBrowser newBrowser) { var chromiumWebBrowser = (ChromiumWebBrowser)browserControl; ChromiumWebBrowser chromiumBrowser = null; var windowX = (windowInfo.X == int.MinValue) ? double.NaN : windowInfo.X; var windowY = (windowInfo.Y == int.MinValue) ? double.NaN : windowInfo.Y; var windowWidth = (windowInfo.Width == int.MinValue) ? double.NaN : windowInfo.Width; var windowHeight = (windowInfo.Height == int.MinValue) ? double.NaN : windowInfo.Height; chromiumWebBrowser.Dispatcher.Invoke(() => { var owner = Window.GetWindow(chromiumWebBrowser); chromiumBrowser = new ChromiumWebBrowser { Address = targetUrl, }; var popup = new Window { Left = windowX, Top = windowY, Width = windowWidth, Height = windowHeight, Content = chromiumBrowser, Owner = owner, Title = targetFrameName }; popup.Closed += (o, e) => { var w = o as Window; if (w != null && w.Content is IWebBrowser) { (w.Content as IWebBrowser).Dispose(); w.Content = null; } }; chromiumBrowser.LifeSpanHandler = this; }); newBrowser = chromiumBrowser; return(false); }
public override void Init(IWindowInfo info) { gc = API.XCreateGC(API.DefaultDisplay, info.WinHandle, IntPtr.Zero, null); }
public override void Resize(IWindowInfo info) { windowPort = OSX.API.GetWindowPort(info.WinHandle); }
public override void Init(IWindowInfo info) { g = Graphics.FromHwnd(info.WinHandle); }
public abstract void Draw(IWindowInfo info, Bitmap framebuffer);
public void WindowShowing(IWindowInfo window, bool bShow) { // throw new NotImplementedException(); }
public void WindowClosed(IWindowInfo window) { window.Close(); // throw new NotImplementedException(); }
public override IGraphicsContext CreateGLContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags) { return(new LinuxGraphicsContext(mode, (LinuxWindowInfo)window, shareContext, major, minor, flags)); }
public virtual IGraphicsContext CreateGLContext(ContextHandle handle, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags) { return(new WinGLContext(handle, (WinWindowInfo)window, shareContext, major, minor, flags)); }
public abstract void Init(IWindowInfo info);
public void SetActiveWindow(IWindowInfo win, bool internalUse = true) { // throw new NotImplementedException(); }
public override IGraphicsContext CreateGLContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags) { throw new NotImplementedException(); }
public override void Update(IWindowInfo window) { }
public static void InitMain(IGraphicsContext context, IWindowInfo winInfo) { mMainInstance = new Onyx3DInstance(context, winInfo); }
protected override bool OnBeforePopup(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame, string targetUrl, string targetFrameName, WindowOpenDisposition targetDisposition, bool userGesture, IPopupFeatures popupFeatures, IWindowInfo windowInfo, IBrowserSettings browserSettings, ref bool noJavascriptAccess, out IWebBrowser newBrowser) { newBrowser = null; return(Logic.OnBeforePopup(targetUrl, ConvertTargetDisposition(targetDisposition))); }
public bool OnBeforePopup(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame, string targetUrl, string targetFrameName, WindowOpenDisposition targetDisposition, bool userGesture, IPopupFeatures popupFeatures, IWindowInfo windowInfo, IBrowserSettings browserSettings, ref bool noJavascriptAccess, out IWebBrowser newBrowser) { newBrowser = null; //TODO add event here return(true); }
public AngleWindowInfo(IWindowInfo platform_window) { _platform_window = platform_window; }
bool ILifeSpanHandler.OnBeforePopup(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, string targetFrameName, WindowOpenDisposition targetDisposition, bool userGesture, IPopupFeatures popupFeatures, IWindowInfo windowInfo, IBrowserSettings browserSettings, ref bool noJavascriptAccess, out IWebBrowser newBrowser) { browser.MainFrame.LoadUrl(targetUrl); newBrowser = null; return(true); }
public IGraphicsContext CreateGLContext(ContextHandle handle, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags) { throw new PlatformNotSupportedException(error_string); }
void SetGraphicsModeARB(GraphicsMode format, IWindowInfo window) { throw new NotImplementedException(); }
public NewWindowEventArgs(IWindowInfo windowInfo, string url) { _windowInfo = windowInfo; this.url = url; }
public void SetWindowProperty(IWindowInfo win, WindowProps property, string value) { // throw new NotImplementedException(); }
public override void Draw(IWindowInfo info, Bitmap framebuffer) { g.DrawImage(framebuffer, 0, 0, framebuffer.Width, framebuffer.Height); }
public TReturnType GetWindowProperty <TReturnType>(IWindowInfo win, WindowProps property) { return(default(TReturnType)); }