当前位置: 首页>>代码示例>>C#>>正文


C# GraphicsContext类代码示例

本文整理汇总了C#中GraphicsContext的典型用法代码示例。如果您正苦于以下问题:C# GraphicsContext类的具体用法?C# GraphicsContext怎么用?C# GraphicsContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GraphicsContext类属于命名空间,在下文中一共展示了GraphicsContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Filter

        public void Filter( GraphicsContext graphics )
        {
            // Y軸方向へのガウス
            // uniform
            int idReciprocalTexHeight = shaderGaussianY.FindUniform( "ReciprocalTexHeight" );
            if( idReciprocalTexHeight >= 0 ){
            shaderGaussianY.SetUniformValue( idReciprocalTexHeight, 1.0f / texScene.Height );
            }
            int idWeight = shaderGaussianY.FindUniform( "Weight" );
            if( idWeight >= 0 ){
            shaderGaussianY.SetUniformValue( idWeight, 0, gaussianWeightTable );
            }
            int idOffset = shaderGaussianY.FindUniform( "Offset" );
            if( idOffset >= 0 ){
            Vector2 offset = new Vector2( 0.0f, 16.0f / texScene.Height );
            shaderGaussianY.SetUniformValue( idOffset, ref offset );
            }

            // render
            FrameBuffer oldBuffer = graphics.GetFrameBuffer();

            if( this.Target != null ){
            graphics.SetFrameBuffer( this.Target );
            }

            texRenderer.BindGraphicsContext( graphics );
            texRenderer.Begin( shaderGaussianY );
            texRenderer.Render( texScene );
            texRenderer.End();

            if( this.Target != null ){
            graphics.SetFrameBuffer( oldBuffer );
            }
        }
开发者ID:hatano0x06,项目名称:Coroppoxus,代码行数:34,代码来源:GaussianYFilter.cs

示例2: Sprite

        public Sprite(GraphicsContext graphics, Texture2D texture)
        {
            if(shaderProgram == null)
            {
                shaderProgram = new ShaderProgram("/Application/shaders/Sprite.cgx");
                shaderProgram.SetUniformBinding(0, "u_WorldMatrix");
            }

            if (texture == null)
            {
                throw new Exception("ERROR: texture is null.");
            }

            this.graphics = graphics;
            this.texture = texture;
            this.width = texture.Width;
            this.height = texture.Height;

            indices = new ushort[indexSize];
            indices[0] = 0;
            indices[1] = 1;
            indices[2] = 2;
            indices[3] = 3;

            vertexBuffer = new VertexBuffer(4, indexSize, VertexFormat.Float3,
                                            VertexFormat.Float2, VertexFormat.Float4);
        }
开发者ID:andierocca,项目名称:destructive-santa,代码行数:27,代码来源:Sprite.cs

示例3: Main

        static void Main(string[] args)
        {
            graphics = new GraphicsContext(960,544,PixelFormat.Rgba,PixelFormat.Depth16,MultiSampleMode.None);
            UISystem.Initialize(graphics);

            MainScene scene = new MainScene();
            SetupListNum(scene.RootWidget);
            scene.SetWidgetLayout(LayoutOrientation.Horizontal);
            UISystem.SetScene(scene);
            for (; ; )
            {
                SystemEvents.CheckEvents();

                // update
                {
                    List<TouchData> touchDataList = Touch.GetData(0);
                    var gamePad = GamePad.GetData (0);
                    UISystem.Update(touchDataList, ref gamePad);
                }

                // draw
                {
                    graphics.SetViewport(0, 0, graphics.Screen.Width, graphics.Screen.Height);
                    graphics.SetClearColor(
                        0xFF,
                        0xFF,
                        0xFF,
                        0xff);
                    graphics.Clear();

                    UISystem.Render();
                    graphics.SwapBuffers();
                }
            }
        }
开发者ID:nakamura001,项目名称:PlayStationMobile-UISampleCode,代码行数:35,代码来源:__DummyProgram.cs

示例4: Saucer

 public Saucer(GraphicsContext g, Texture2D t, Vector3 p, Player pl)
     : base(g,t,p, pl)
 {
     player = pl;
     vel= (new Vector3(.5f*(float)gen.Next(3,5),.7f*(float)gen.Next(3,5),0));
     graphics=g;
 }
开发者ID:andierocca,项目名称:destructive-santa,代码行数:7,代码来源:Saucer.cs

示例5: RayTracerWindow

        public RayTracerWindow(int width, int height)
        {
            _nativeWindow = new NativeWindow(width, height, "", GameWindowFlags.Default, GraphicsMode.Default, DisplayDevice.Default);
            GraphicsContextFlags flags = GraphicsContextFlags.Default;
            #if DEBUG
            //flags |= GraphicsContextFlags.Debug;
            #endif
            _graphicsContext = new GraphicsContext(GraphicsMode.Default, _nativeWindow.WindowInfo, 3, 0, flags);
            _graphicsContext.MakeCurrent(_nativeWindow.WindowInfo);
            ((IGraphicsContextInternal)_graphicsContext).LoadAll(); // wtf is this?

            SetInitialStates();
            SetViewport();

            _nativeWindow.Resize += OnGameWindowResized;
            _nativeWindow.Closing += OnWindowClosing;
            _nativeWindow.KeyDown += OnKeyDown;

            _scene = Scene.TwoPlanes;
            _scene.Camera.ReflectionDepth = DefaultReflectionDepth;

            SetTitle();

            _renderTexture = new RenderTexture(_nativeWindow.Width, _nativeWindow.Height);

            _scenes = typeof(Scene).GetProperties()
                .Where(pi => pi.PropertyType == typeof(Scene))
                .Select(pi => pi.GetValue(null))
                .Cast<Scene>().ToList();
        }
开发者ID:mellinoe,项目名称:RayTracer,代码行数:30,代码来源:RayTracerWindow.cs

示例6: PaintVerticalBar

 protected override void PaintVerticalBar(GraphicsContext context, SizeF size, SizeF knobSize)
 {
     var rect = new RectangleF (new PointF (), new SizeF (knobSize.Width, size.Height - knobSize.Height));
     var brush = new LinearGradientBrush (rect, Color.Black, Color.Black,
         LinearGradientMode.Vertical);
     DrawBar (context, brush, rect);
 }
开发者ID:johtela,项目名称:Compose3D,代码行数:7,代码来源:ColorSlider.cs

示例7: GraphicsContextEventArgs

        public GraphicsContextEventArgs(GraphicsContext context)
        {
            if (context == null)
                throw new ArgumentNullException("context");

            this.Graphics = context;
        }
开发者ID:HaKDMoDz,项目名称:Samurai,代码行数:7,代码来源:GraphicsContextEventArgs.cs

示例8: InitGL

 private void InitGL()
 {
     windowInfo = Utilities.CreateWindowsWindowInfo(window.Handle);
     context = new GraphicsContext(GraphicsMode.Default, windowInfo);
     context.MakeCurrent(windowInfo);
     context.LoadAll();
 }
开发者ID:lilinghui,项目名称:DeltaEngine,代码行数:7,代码来源:OpenTKDevice.cs

示例9: Claw

 public Claw(GraphicsContext g, Texture2D t, Vector3 p)
     : base(g,t,p)
 {
     graphics = g;
     sprite.Position = p;
     vel= (new Vector3(0, -1, 0));
 }
开发者ID:andierocca,项目名称:destructive-santa,代码行数:7,代码来源:Claw.cs

示例10: DebugString

        public DebugString(GraphicsContext graphics, Texture2D texture, int charaWidth, int charaHeight)
        {
            if(shaderProgram == null)
            {
                shaderProgram=CreateSimpleSpriteShader();
            }

            this.graphics = graphics;

            this.texture = texture;

            this.charaWidth = charaWidth;
            this.charaHeight = charaHeight;

            charaPositions = new float[maxNumOfCharactor * 4 * 3];
            charaTexcoords = new float[maxNumOfCharactor * 4 * 2];
            charaColors = new float[maxNumOfCharactor * 4 * 4];
            charaIndices = new ushort[maxNumOfCharactor * indexSize];

            vertices = new VertexBuffer(maxNumOfCharactor * 4, maxNumOfCharactor * indexSize,
                VertexFormat.Float3, VertexFormat.Float2, VertexFormat.Float4);

            PixelScreenPosition = new Vector3(0.0f, 0.0f, 0.0f);

            ImageRect rectPixelScreen = graphics.GetViewport();

            //@j ピクセルの座標系をスクリーンの座標系に変換する行列。
            //@e Line to convert a pixel coordinate system into a screen coordinate system.
            unitScreenMatrix = new Matrix4(
                 2.0f/rectPixelScreen.Width,	0.0f,	0.0f, 0.0f,
                 0.0f, -2.0f/rectPixelScreen.Height,	0.0f, 0.0f,
                 0.0f,	0.0f, 1.0f, 0.0f,
                -1.0f, 1.0f, 0.0f, 1.0f
            );
        }
开发者ID:simard,项目名称:FloWS,代码行数:35,代码来源:DebugString.cs

示例11: InitGraphicsContext

 public static void InitGraphicsContext()
 {
     if (null != sm_GraphicsContext) {
     return;
     }
     sm_GraphicsContext = new GraphicsContext();
 }
开发者ID:khiraiwa,项目名称:psm-avi_movie_player,代码行数:7,代码来源:AppMain.cs

示例12: Initialize

        public static void Initialize()
        {
            // Set up the graphics system
            graphics = new GraphicsContext ();
            // Set up background sprite
            ImageRect rectScreen = graphics.Screen.Rectangle;
            Console.WriteLine("Screen size: " + rectScreen.Width + " x " + rectScreen.Height);

            texture = new Texture2D("/Application/resources/bg.png", false);
            bgSprite = new Sprite(graphics, texture);
            bgSprite.Position.X = 0.0f; //rectScreen.Width/2.0f;
            bgSprite.Position.Y = 0.0f; //rectScreen.Height/2.0f;
            bgSprite.Position.Z = 0.0f;

            patternGrid = new PatternGrid(graphics, texture, new Vector2(240.0f, 144.0f), new Vector2(720.0f, 400.0f));
            patternGrid.Update(currentPattern);

            textWriter = new Text(graphics, 16.0f);

            m_song.Load("/Documents/songs/flowers1.xds");

            // Start playback thread
            //simStart = false;
            playbackThread = new Thread(new ThreadStart(playbackThreadMain));
            playbackThread.Start();
        }
开发者ID:james7780,项目名称:PXDrumVita,代码行数:26,代码来源:AppMain.cs

示例13: Initialize

		public static void Initialize ()
		{
			// Set up the graphics system
			graphics = new GraphicsContext ();
#if BUILD_FOR_PSV
			program = new ShaderProgram("/Application/shaders/Texture.cgx");
#else
			program = new ShaderProgram("/Application/shaders/Texture_sim.cgx");
#endif
			program.SetUniformBinding(0, "WorldViewProj");
			program.SetAttributeBinding(0, "a_Position");
			program.SetAttributeBinding(1, "a_TexCoord");
			vertices = new VertexBuffer(4, VertexFormat.Float3, VertexFormat.Float2);

			float[] positions = {
				-1.0f, 1.0f, 0.0f,
				-1.0f, -1.0f, 0.0f,
				1.0f, 1.0f, 0.0f,
				1.0f, -1.0f, 0.0f,
			};
			float[] texcoords = {
				0.0f, 0.0f,
				0.0f, 1.0f,
				1.0f, 0.0f,
				1.0f, 1.0f,
			};
			vertices.SetVertices(0, positions);
			vertices.SetVertices(1, texcoords);
			texture = new Texture2D(256, 224, false, PixelFormat.Rgb565);
			
			SampleDraw.Init(graphics);
			
		}
开发者ID:Theswweet,项目名称:PSV-FC,代码行数:33,代码来源:AppMain.cs

示例14: Initialize

        public static void Initialize()
        {
            // Set up the graphics system
            _graphics = new GraphicsContext ();

            _texture = new Texture2D("/Application/32.png", false);

            _spriteBatch = new MonoGameSpriteBatch(_graphics, 256);
            //_spriteBatch = new MonoGameSpriteBatchNoIndex(_graphics, 256);
            //_spriteBatch = new MonoGameSpriteBatchVector3(_graphics, 256);
            //_spriteBatch = new MonoGameSpriteBatchUnpacked(_graphics, 256);

            //_spriteBatch = new DoubleBufferedSpriteBatch(new MonoGameSpriteBatch(_graphics, 256), new MonoGameSpriteBatch(_graphics, 256));
            //_spriteBatch = new TripleBufferedSpriteBatch(new MonoGameSpriteBatch(_graphics, 256), new MonoGameSpriteBatch(_graphics, 256), new MonoGameSpriteBatch(_graphics, 256));

            //_spriteBatch = new DoubleBufferedSpriteBatch(
            //	new DoubleBufferedSpriteBatch(new MonoGameSpriteBatch(_graphics, 256), new MonoGameSpriteBatch(_graphics, 256)),
            //	new DoubleBufferedSpriteBatch(new MonoGameSpriteBatch(_graphics, 256), new MonoGameSpriteBatch(_graphics, 256)));

            //_spriteBatch = new TripleBufferedSpriteBatch(
            //	new TripleBufferedSpriteBatch(new MonoGameSpriteBatch(_graphics, 256), new MonoGameSpriteBatch(_graphics, 256), new MonoGameSpriteBatch(_graphics, 256)),
            //	new TripleBufferedSpriteBatch(new MonoGameSpriteBatch(_graphics, 256), new MonoGameSpriteBatch(_graphics, 256), new MonoGameSpriteBatch(_graphics, 256)),
            //	new TripleBufferedSpriteBatch(new MonoGameSpriteBatch(_graphics, 256), new MonoGameSpriteBatch(_graphics, 256), new MonoGameSpriteBatch(_graphics, 256)));

            //_spriteBatch2 = new MonoGameSpriteBatch(_graphics, 256);
        }
开发者ID:danzel,项目名称:PssSpritePerformanceTests,代码行数:26,代码来源:AppMain.cs

示例15: Filter

        /// フィルタ処理の実行
        public void Filter( GraphicsContext graphics )
        {
            texRenderer.BindGraphicsContext( graphics );
            FrameBuffer oldBuffer = graphics.GetFrameBuffer();

            bool isSwap = false;
            int width = oldBuffer.Width;
            int height = oldBuffer.Height;

            if( this.Target != null ){
            graphics.SetFrameBuffer( this.Target );
            width = this.Target.Width;
            height = this.Target.Height;
            isSwap = true;
            }
            graphics.SetViewport( 0, 0, width, height );

            texRenderer.Begin( shaderDOF );
            graphics.SetTexture( 2, texDepth );
            texRenderer.Render( texScene,
                            texBlur,
                            0, 0, 0, 0, width, height );
            texRenderer.End();
            if( isSwap ){
            graphics.SetFrameBuffer( oldBuffer );
            }
        }
开发者ID:hatano0x06,项目名称:Coroppoxus,代码行数:28,代码来源:DepthOfFealdFilter.cs


注:本文中的GraphicsContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。