00001 #region License
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #endregion
00027
00028 using System;
00029 using System.Diagnostics;
00030 using OpenTK.Graphics;
00031
00032 namespace OpenTK.Platform.X11
00033 {
00034 class X11Factory : IPlatformFactory
00035 {
00036 #region Constructors
00037
00038 public X11Factory()
00039 {
00040 int result = Functions.XInitThreads();
00041 Debug.Print("Initializing threaded X: {0}.", result != 0 ? "success" : "failed");
00042 }
00043
00044 #endregion
00045
00046 #region IPlatformFactory Members
00047
00048 public virtual INativeWindow CreateNativeWindow(int x, int y, int width, int height, string title, GraphicsMode mode, GameWindowFlags options, DisplayDevice device)
00049 {
00050 return new X11GLNative(x, y, width, height, title, mode, options, device);
00051 }
00052
00053 public virtual IDisplayDeviceDriver CreateDisplayDeviceDriver()
00054 {
00055 return new X11XrandrDisplayDevice();
00056 }
00057
00058 public virtual IGraphicsContext CreateGLContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags)
00059 {
00060 return new X11GLContext(mode, window, shareContext, directRendering, major, minor, flags);
00061 }
00062
00063 public virtual IGraphicsContext CreateGLContext(ContextHandle handle, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags)
00064 {
00065 return new X11GLContext(handle, window, shareContext, directRendering, major, minor, flags);
00066 }
00067
00068 public virtual GraphicsContext.GetCurrentContextDelegate CreateGetCurrentGraphicsContext()
00069 {
00070 return (GraphicsContext.GetCurrentContextDelegate)delegate
00071 {
00072 return new ContextHandle(Glx.GetCurrentContext());
00073 };
00074 }
00075
00076 public virtual IGraphicsMode CreateGraphicsMode()
00077 {
00078 return new X11GraphicsMode();
00079 }
00080
00081 public virtual OpenTK.Input.IKeyboardDriver CreateKeyboardDriver()
00082 {
00083 throw new NotImplementedException();
00084 }
00085
00086 #endregion
00087 }
00088 }