/// <summary> /// Default constructor. /// </summary> public Driver( GraphicsAdapter adapterDetails ) { #if SILVERLIGHT _desktopMode = new DisplayMode { Width = (int)XnaRenderWindow.DrawingSurface.Width, Height = (int)XnaRenderWindow.DrawingSurface.Height, Format = SurfaceFormat.Color }; _name = "Silverlight XNA"; _description = "Silverlight XNA Device"; _adapterNum = 0; _adapterIdentifier = new Guid(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); _adapter = adapterDetails; _videoModeList = new VideoModeCollection { new VideoMode( _desktopMode ) }; #else _desktopMode = adapterDetails.CurrentDisplayMode; _name = adapterDetails.DeviceName; _description = adapterDetails.Description; _adapterNum = adapterDetails.DeviceId; _adapterIdentifier = new Guid(adapterDetails.VendorId, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); _adapter = adapterDetails; _videoModeList = new VideoModeCollection(); #endif }
public GraphicsDeviceInformation() { deviceType = DeviceType.Hardware; adapter = GraphicsAdapter.DefaultAdapter; presentationParameters = new PresentationParameters(); presentationParameters.Clear(); }
public Renderer( PresentationParameters p_PresentationParameters ) { m_GraphicsAdapter = GraphicsAdapter.DefaultAdapter; m_PresentationParameters = p_PresentationParameters; #if XBOX360 m_PresentationParameters.BackBufferWidth = m_GraphicsAdapter.CurrentDisplayMode.Width; m_PresentationParameters.BackBufferHeight = m_GraphicsAdapter.CurrentDisplayMode.Height; m_PresentationParameters.IsFullScreen = true; #endif m_GraphicsDeviceService = GraphicsDeviceService.AddReference( m_PresentationParameters ); m_ServiceContainer.AddService< IGraphicsDeviceService >( m_GraphicsDeviceService ); m_ClearColour = new Color( 1.0f, 1.0f, 1.0f ); m_Width = m_PresentationParameters.BackBufferWidth; m_Height = m_PresentationParameters.BackBufferHeight; if( GamerServicesDispatcher.IsInitialized == false ) { GamerServicesDispatcher.WindowHandle = m_GraphicsDeviceService.GraphicsDevice. PresentationParameters.DeviceWindowHandle; GamerServicesDispatcher.Initialize( m_ServiceContainer ); GamerServicesDispatcher.Update( ); } }
public static void Info(GraphicsAdapter graphicsAdapter) { Logger.Info("DeviceId: {0}", graphicsAdapter.DeviceId); Logger.Info("DeviceName: {0}", graphicsAdapter.DeviceName); Logger.Info("Description: {0}", graphicsAdapter.Description); Logger.Info("VendorId: {0}", graphicsAdapter.VendorId); Logger.Info("Revision: {0}", graphicsAdapter.Revision); Logger.Info("SubSystemId: {0}", graphicsAdapter.SubSystemId); Logger.Info("IsDefaultAdapter: {0}", graphicsAdapter.IsDefaultAdapter); Logger.Info("IsWideScreen: {0}", graphicsAdapter.IsWideScreen); Logger.Info("CurrentDisplayMode: {0}", graphicsAdapter.CurrentDisplayMode); //Logger.Info("SupportedDisplayModes={"); //foreach (var mode in graphicsAdapter.SupportedDisplayModes) logger.Info(" {0}", mode); //Logger.Info("}"); }
/// <summary> /// Initializes a new instance of the <see cref="XNAGraphicsAdapter"/> class. /// </summary> /// <param name="graphicsDevice">The graphics device.</param> /// <param name="adapter">The adapter.</param> /// <param name="adapterIndex">Index of the adapter.</param> internal XNAGraphicsAdapter(XFG.GraphicsDevice graphicsDevice, XFG.GraphicsAdapter adapter, int adapterIndex) { _graphicsDevice = graphicsDevice; _adapter = adapter; _adapterIndex = adapterIndex; List <DisplayMode> list = new List <DisplayMode>(); foreach (XFG.DisplayMode mode in adapter.SupportedDisplayModes) { DisplayMode display = new DisplayMode(mode.Width, mode.Height, XNAHelper.FromXNASurfaceFormat(mode.Format)); if (list.Contains(display)) { list.Add(display); } } _displayModes = new DisplayModeCollection(list); _supportedTextureFormats = new List <XFG.SurfaceFormat>(new XFG.SurfaceFormat[] { XFG.SurfaceFormat.Color, XFG.SurfaceFormat.Bgr565, XFG.SurfaceFormat.Bgra5551, XFG.SurfaceFormat.Bgra4444, XFG.SurfaceFormat.NormalizedByte2, XFG.SurfaceFormat.NormalizedByte4, XFG.SurfaceFormat.Dxt1, XFG.SurfaceFormat.Dxt3, XFG.SurfaceFormat.Dxt5 }); if (graphicsDevice.GraphicsProfile == XFG.GraphicsProfile.HiDef) { _supportedVertexTextureFormats = new List <XFG.SurfaceFormat>(new XFG.SurfaceFormat[] { XFG.SurfaceFormat.Single, XFG.SurfaceFormat.Vector4, XFG.SurfaceFormat.Vector2, XFG.SurfaceFormat.HalfVector2, XFG.SurfaceFormat.HalfVector4, XFG.SurfaceFormat.HalfSingle }); _supportedTextureFormats.AddRange(new XFG.SurfaceFormat[] { XFG.SurfaceFormat.Alpha8, XFG.SurfaceFormat.Rg32, XFG.SurfaceFormat.Rgba64, XFG.SurfaceFormat.Rgba1010102, XFG.SurfaceFormat.Single, XFG.SurfaceFormat.Vector2, XFG.SurfaceFormat.Vector4, XFG.SurfaceFormat.HalfSingle, XFG.SurfaceFormat.HalfVector2, XFG.SurfaceFormat.HalfVector4 }); } }
public GraphicsDevice( GraphicsAdapter adapter, GraphicsProfile graphicsProfile, PresentationParameters presentationParameters) { Screen = Sdl.SDL_SetVideoMode(800, 600, 32, Sdl.SDL_SWSURFACE | Sdl.SDL_OPENGL | Sdl.SDL_GL_DOUBLEBUFFER | Sdl.SDL_ANYFORMAT); Sdl.SDL_GL_SetAttribute ( Sdl.SDL_GL_DOUBLEBUFFER, 1 ); Gl.glEnable( Gl.GL_TEXTURE ); Gl.glEnable( Gl.GL_TEXTURE_2D ); Gl.glShadeModel( Gl.GL_SMOOTH ); Gl.glClearColor( 0.0f, 0.0f, 0.0f, 0.0f ); Gl.glClearDepth( 1.0f ); Gl.glEnable( Gl.GL_DEPTH_TEST ); Gl.glDepthFunc( Gl.GL_LEQUAL ); Gl.glHint( Gl.GL_PERSPECTIVE_CORRECTION_HINT, Gl.GL_NICEST ); Resize(800, 600); }
public GraphicsDeviceCreationParameters(GraphicsAdapter graphicsAdapter, DeviceType deviceType, IntPtr windowHandle, CreateOptions createOptions) { throw new NotImplementedException(); }
public static GraphicsAdapter[] GetGraphicsAdapters() { SDL.SDL_DisplayMode filler = new SDL.SDL_DisplayMode(); GraphicsAdapter[] adapters = new GraphicsAdapter[SDL.SDL_GetNumVideoDisplays()]; for (int i = 0; i < adapters.Length; i += 1) { List<DisplayMode> modes = new List<DisplayMode>(); int numModes = SDL.SDL_GetNumDisplayModes(i); for (int j = 0; j < numModes; j += 1) { SDL.SDL_GetDisplayMode(i, j, out filler); // Check for dupes caused by varying refresh rates. bool dupe = false; foreach (DisplayMode mode in modes) { if (filler.w == mode.Width && filler.h == mode.Height) { dupe = true; } } if (!dupe) { modes.Add( new DisplayMode( filler.w, filler.h, SurfaceFormat.Color // FIXME: Assumption! ) ); } } SDL.SDL_GetCurrentDisplayMode(i, out filler); adapters[i] = new GraphicsAdapter( new DisplayMode( filler.w, filler.h, SurfaceFormat.Color // FIXME: Assumption! ), new DisplayModeCollection(modes), SDL.SDL_GetDisplayName(i) ); } return adapters; }
public void Reset( PresentationParameters presentationParameters, GraphicsAdapter graphicsAdapter ) { if (presentationParameters == null) { throw new ArgumentNullException("presentationParameters"); } PresentationParameters = presentationParameters; Adapter = graphicsAdapter; // Verify MSAA before we really start... PresentationParameters.MultiSampleCount = Math.Min( MathHelper.ClosestMSAAPower( PresentationParameters.MultiSampleCount ), GLDevice.MaxMultiSampleCount ); // We're about to reset, let the application know. if (DeviceResetting != null) { DeviceResetting(this, EventArgs.Empty); } /* FIXME: Why are we not doing this...? -flibit * lock (resourcesLock) * { * foreach (WeakReference resource in resources) * { * object target = resource.Target; * if (target != null) * { * (target as GraphicsResource).GraphicsDeviceResetting(); * } * } * * // Remove references to resources that have been garbage collected. * resources.RemoveAll(wr => !wr.IsAlive); * } */ /* Reset the backbuffer first, before doing anything else. * The GLDevice needs to know what we're up to right away. * -flibit */ GLDevice.ResetBackbuffer( PresentationParameters, Adapter, RenderTargetCount > 0 ); // The mouse needs to know this for faux-backbuffer mouse scaling. Input.Mouse.INTERNAL_BackBufferWidth = PresentationParameters.BackBufferWidth; Input.Mouse.INTERNAL_BackBufferHeight = PresentationParameters.BackBufferHeight; #if WIIU_GAMEPAD wiiuPixelData = new byte[ PresentationParameters.BackBufferWidth * PresentationParameters.BackBufferHeight * 4 ]; #endif // Now, update the viewport Viewport = new Viewport( 0, 0, PresentationParameters.BackBufferWidth, PresentationParameters.BackBufferHeight ); // Update the scissor rectangle to our new default target size ScissorRectangle = new Rectangle( 0, 0, PresentationParameters.BackBufferWidth, PresentationParameters.BackBufferHeight ); // We just reset, let the application know. if (DeviceReset != null) { DeviceReset(this, EventArgs.Empty); } }
private DepthFormat ChooseDepthStencilFormat(GraphicsAdapter adapter, DeviceType deviceType, SurfaceFormat adapterFormat) { if (adapter.CheckDeviceFormat(deviceType, adapterFormat, TextureUsage.None, QueryUsages.None, ResourceType.DepthStencilBuffer, this.PreferredDepthStencilFormat)) { return this.PreferredDepthStencilFormat; } if (Array.IndexOf<DepthFormat>(depthFormatsWithStencil, this.PreferredDepthStencilFormat) >= 0) { DepthFormat format = this.ChooseDepthStencilFormatFromList(depthFormatsWithStencil, adapter, deviceType, adapterFormat); if (format != DepthFormat.Unknown) { return format; } } DepthFormat format2 = this.ChooseDepthStencilFormatFromList(depthFormatsWithoutStencil, adapter, deviceType, adapterFormat); if (format2 != DepthFormat.Unknown) { return format2; } return DepthFormat.Depth24; }
public CBeroGraphicsDevice(GraphicsAdapter adapter, GraphicsProfile graphicsProfile, PresentationParameters presentationParameters) : base(adapter, graphicsProfile, presentationParameters) { }
// 构造函数 public Browser() { // 图形和内容管理器实例化 graphics_ = new GraphicsDeviceManager(this); // 抗锯齿有效 graphics_.PreferMultiSampling = true; // 设置窗口大小 ClientHeight = 768 - 32; ClientWidth = 1366 - 6; graphics_.PreferredBackBufferWidth = ClientWidth; graphics_.PreferredBackBufferHeight = ClientHeight; // 设置窗口名称 this.Window.Title = Title; // 可以调整窗口大小 this.Window.AllowUserResizing = true; // 窗口不显示鼠标 this.IsMouseVisible = false; // 是否固定60 FPS(詳細はXNAの仕様を参照 http://blogs.msdn.com/ito/archive/2007/03/08/2-update.aspx) #if CALC_FPS this.IsFixedTimeStep = false; #else this.IsFixedTimeStep = true; this.TargetElapsedTime = TimeSpan.FromSeconds(1d / 60d); #endif graphics_.ApplyChanges(); // 读取设定文件(图像日志) //controlPanel_.ReadPhotoLogs(photoLog_); //controlPanel_.ReadPeopleLogs(peopleTags); IntPtr hWnd = this.Window.Handle; control = System.Windows.Forms.Control.FromHandle(hWnd); this.Window.ClientSizeChanged += new EventHandler<EventArgs>(Window_ClientSizeChanged); this.control.Move += new EventHandler(control_Move); //batch_ = new SpriteBatch(this.GraphicsDevice); //provide global access to game instance, so other classes can access graphicsdevice Instance = this; clientBounds = new BoundingBox2D(new Vector2(Window.ClientBounds.Left, Window.ClientBounds.Top), new Vector2(Window.ClientBounds.Right, Window.ClientBounds.Bottom), 0f); rawInput = new RawInputForm(); pdCollection = rawInput.pdCollection; //one more pointing device, store touch data //pdCollection.add(new PointingDevice(0, new Vector2(6000, 6000))); systemState = new SystemState(); wall = new Wall(); graphicsAdapter = graphics_.GraphicsDevice.Adapter; }
public void Reset(Microsoft.Xna.Framework.Graphics.PresentationParameters presentationParameters, GraphicsAdapter graphicsAdapter) { throw new NotImplementedException(); }
private static GraphicsAdapter CreateAdapter(SharpDX.DXGI.Adapter1 device, SharpDX.DXGI.Output monitor) { var adapter = new GraphicsAdapter(); adapter.DeviceName = monitor.Description.DeviceName; adapter.Description = device.Description1.Description; adapter.DeviceId = device.Description1.DeviceId; adapter.Revision = device.Description1.Revision; adapter.VendorId = device.Description1.VendorId; adapter.SubSystemId = device.Description1.SubsystemId; adapter.MonitorHandle = monitor.Description.MonitorHandle; #if WINDOWS_UAP var desktopWidth = monitor.Description.DesktopBounds.Right - monitor.Description.DesktopBounds.Left; var desktopHeight = monitor.Description.DesktopBounds.Bottom - monitor.Description.DesktopBounds.Top; #else var desktopWidth = monitor.Description.DesktopBounds.Width; var desktopHeight = monitor.Description.DesktopBounds.Height; #endif var modes = new List <DisplayMode>(); foreach (var formatTranslation in FormatTranslations) { SharpDX.DXGI.ModeDescription[] displayModes; // This can fail on headless machines, so just assume the desktop size // is a valid mode and return that... so at least our unit tests work. try { displayModes = monitor.GetDisplayModeList(formatTranslation.Key, 0); } catch (SharpDX.SharpDXException ex) { var mode = new DisplayMode(desktopWidth, desktopHeight, SurfaceFormat.Color); modes.Add(mode); adapter._currentDisplayMode = mode; break; } foreach (var displayMode in displayModes) { var mode = new DisplayMode(displayMode.Width, displayMode.Height, formatTranslation.Value); // Skip duplicate modes with the same width/height/formats. if (modes.Contains(mode)) { continue; } modes.Add(mode); if (mode.Width == desktopWidth && mode.Height == desktopHeight && mode.Format == SurfaceFormat.Color) { if (adapter._currentDisplayMode == null) { adapter._currentDisplayMode = mode; } } } } adapter._supportedDisplayModes = new DisplayModeCollection(modes); return(adapter); }
public void Initialize(string path) { dock_ = new Dock(ResourceManager.iconNumber_); //pdCollection.initialize(); photoDisplay = new PhotoDisplay(systemState, dock_, timeStateManager.sBar, strokeGroup); inputController = new MouseController(pdCollection, dock_, timeStateManager.sBar, systemState, photoDisplay, strokeGroup, keyboard); inputController.InitialOpen(path); graphicsAdapter = graphicsDevice.Adapter; }
public void Reset(GraphicsAdapter graphicsAdapter) { throw new NotImplementedException(); }
public void Reset(PresentationParameters presentationParameters, GraphicsAdapter graphicsAdapter) { throw new NotImplementedException(); }
private void AddDevices(GraphicsAdapter adapter, DeviceType deviceType, DisplayMode mode, GraphicsDeviceInformation baseDeviceInfo, List<GraphicsDeviceInformation> foundDevices) { for (int i = 0; i < ValidBackBufferFormats.Length; i++) { SurfaceFormat backBufferFormat = ValidBackBufferFormats[i]; if (adapter.CheckDeviceType(deviceType, mode.Format, backBufferFormat, this.IsFullScreen)) { GraphicsDeviceInformation item = baseDeviceInfo.Clone(); if (this.IsFullScreen) { item.PresentationParameters.BackBufferWidth = mode.Width; item.PresentationParameters.BackBufferHeight = mode.Height; item.PresentationParameters.FullScreenRefreshRateInHz = mode.RefreshRate; } else if (this.useResizedBackBuffer) { item.PresentationParameters.BackBufferWidth = this.resizedBackBufferWidth; item.PresentationParameters.BackBufferHeight = this.resizedBackBufferHeight; } else { item.PresentationParameters.BackBufferWidth = this.PreferredBackBufferWidth; item.PresentationParameters.BackBufferHeight = this.PreferredBackBufferHeight; } item.PresentationParameters.BackBufferFormat = backBufferFormat; item.PresentationParameters.AutoDepthStencilFormat = this.ChooseDepthStencilFormat(adapter, deviceType, mode.Format); if (this.PreferMultiSampling) { for (int j = 0; j < multiSampleTypes.Length; j++) { int qualityLevels = 0; MultiSampleType sampleType = multiSampleTypes[j]; if (adapter.CheckDeviceMultiSampleType(deviceType, backBufferFormat, this.IsFullScreen, sampleType, out qualityLevels)) { GraphicsDeviceInformation information2 = item.Clone(); information2.PresentationParameters.MultiSampleType = sampleType; if (!foundDevices.Contains(information2)) { foundDevices.Add(information2); } break; } } } else if (!foundDevices.Contains(item)) { foundDevices.Add(item); } } } }
// Token: 0x0600107E RID: 4222 // RVA: 0x00056980 File Offset: 0x00054B80 internal static Screen smethod_3(GraphicsAdapter graphicsAdapter_0) { Screen[] allScreens = Screen.AllScreens; for (int i = 0; i < allScreens.Length; i++) { Screen screen = allScreens[i]; if (Class122.smethod_0(screen) == graphicsAdapter_0.get_DeviceName()) { return screen; } } throw new ArgumentException(Class127.smethod_7(), "adapter"); }
private DepthFormat ChooseDepthStencilFormatFromList(DepthFormat[] availableFormats, GraphicsAdapter adapter, DeviceType deviceType, SurfaceFormat adapterFormat) { for (int i = 0; i < availableFormats.Length; i++) { if ((availableFormats[i] != this.PreferredDepthStencilFormat) && adapter.CheckDeviceFormat(deviceType, adapterFormat, TextureUsage.None, QueryUsages.None, ResourceType.DepthStencilBuffer, availableFormats[i])) { return availableFormats[i]; } } return DepthFormat.Unknown; }
/// <summary> /// Initializes a new instance of the <see cref="GraphicsDevice" /> class. /// </summary> /// <param name="adapter">The graphics adapter.</param> /// <param name="graphicsProfile">The graphics profile.</param> /// <param name="presentationParameters">The presentation options.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="presentationParameters"/> is <see langword="null"/>. /// </exception> public GraphicsDevice( GraphicsAdapter adapter, GraphicsProfile graphicsProfile, PresentationParameters presentationParameters ) { if (presentationParameters == null) { throw new ArgumentNullException("presentationParameters"); } // Set the properties from the constructor parameters. Adapter = adapter; PresentationParameters = presentationParameters; GraphicsProfile = graphicsProfile; PresentationParameters.MultiSampleCount = MathHelper.ClosestMSAAPower( PresentationParameters.MultiSampleCount ); // Set up the IGLDevice GLDevice = FNAPlatform.CreateGLDevice(PresentationParameters, adapter); // The mouse needs to know this for faux-backbuffer mouse scaling. Input.Mouse.INTERNAL_BackBufferWidth = PresentationParameters.BackBufferWidth; Input.Mouse.INTERNAL_BackBufferHeight = PresentationParameters.BackBufferHeight; // Force set the default render states. BlendState = BlendState.Opaque; DepthStencilState = DepthStencilState.Default; RasterizerState = RasterizerState.CullCounterClockwise; // Initialize the Texture/Sampler state containers int maxTextures = Math.Min(GLDevice.MaxTextureSlots, MAX_TEXTURE_SAMPLERS); int maxVertexTextures = MathHelper.Clamp( GLDevice.MaxTextureSlots - MAX_TEXTURE_SAMPLERS, 0, MAX_VERTEXTEXTURE_SAMPLERS ); vertexSamplerStart = GLDevice.MaxTextureSlots - maxVertexTextures; Textures = new TextureCollection( maxTextures, modifiedSamplers ); SamplerStates = new SamplerStateCollection( maxTextures, modifiedSamplers ); VertexTextures = new TextureCollection( maxVertexTextures, modifiedVertexSamplers ); VertexSamplerStates = new SamplerStateCollection( maxVertexTextures, modifiedVertexSamplers ); // Set the default viewport and scissor rect. Viewport = new Viewport(PresentationParameters.Bounds); ScissorRectangle = Viewport.Bounds; #if WIIU_GAMEPAD wiiuStream = DRC.drc_new_streamer(); if (wiiuStream == IntPtr.Zero) { FNALoggerEXT.LogError("Failed to alloc GamePad stream!"); return; } if (DRC.drc_start_streamer(wiiuStream) < 1) // ??? { FNALoggerEXT.LogError("Failed to start GamePad stream!"); DRC.drc_delete_streamer(wiiuStream); wiiuStream = IntPtr.Zero; return; } DRC.drc_enable_system_input_feeder(wiiuStream); wiiuPixelData = new byte[ PresentationParameters.BackBufferWidth * PresentationParameters.BackBufferHeight * 4 ]; #endif }