コード例 #1
0
ファイル: GraphicsDevice.cs プロジェクト: K0bin/DotGame
        public GraphicsDevice(IGameWindow window, IWindowContainer container, GraphicsContext context, DeviceCreationFlags creationFlags)
        {
            if (window == null)
            {
                throw new ArgumentNullException("window");
            }
            if (container == null)
            {
                throw new ArgumentNullException("container");
            }
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            if (context.IsDisposed)
            {
                throw new ArgumentException("context is disposed.", "context");
            }

            this.DefaultWindow = window;
            this.container     = container;
            this.Context       = context;
            this.CreationFlags = creationFlags;

            Log.Debug("Got context: [ColorFormat: {0}, Depth: {1}, Stencil: {2}, FSAA Samples: {3}, AccumulatorFormat: {4}, Buffers: {5}, Stereo: {6}]",
                      Context.GraphicsMode.ColorFormat,
                      Context.GraphicsMode.Depth,
                      Context.GraphicsMode.Stencil,
                      Context.GraphicsMode.Samples,
                      Context.GraphicsMode.AccumulatorFormat,
                      Context.GraphicsMode.Buffers,
                      Context.GraphicsMode.Stereo);

            Context.LoadAll();

            capabilities = new GraphicsCapabilities();

            CheckGraphicsCapabilities(LogLevel.Verbose);

            Factory            = new GraphicsFactory(this);
            BindManager        = new OpenGL4.BindManager(this);
            this.RenderContext = new RenderContext(this);

            Context.MakeCurrent(null);
        }
コード例 #2
0
ファイル: GraphicsDevice.cs プロジェクト: K0bin/DotGame
        //RenderTarget
        internal FrameBuffer GetFBO(FrameBufferDescription description)
        {
            if (!description.HasAttachments)
            {
                return(null);
            }

            FrameBuffer fbo;

            if (fboPool.TryGetValue(description, out fbo))
            {
                return(fbo);
            }

            GraphicsFactory factory = (GraphicsFactory)Factory;

            fbo = factory.CreateFrameBuffer(description);
            fboPool.Add(description, fbo);
            return(fbo);
        }