コード例 #1
0
ファイル: SceneFirstMenu.cs プロジェクト: peges/hungry
            protected virtual void Draw()
            {
                double t = StuffTimer.Elapsed.TotalSeconds * 0.2;

                _Texture.Bind();
                GL.PushMatrix();

                double rotate = 40 * t;

                GL.Translate(_Position.X, _Position.Y, _Position.Z);
                //GL.Rotate(rotate, 0.0, 1.0, 0.0);
                GL.Translate(-20 * (_Wide / 2), 0.0, 0.0);

                for (int i = 0; i < _Wide; i++)
                {
                    GL.Translate(20.0, 0.0, 0.0);
                    GL.PushMatrix();
                    //GL.Rotate(-rotate, 0.0, 1.0, 0.0);
                    double f = Math.Sin(t + i * 0.25);
                    for (int j = 0; j < _High; j++)
                    {
                        GL.Translate(0.0, 20.0, 0.0);
                        double g = Math.Sin(t + j * 0.5);
                        double h = f + g;
                        double r = f * g;
                        double a = (h * r + 1) / 2;

                        GL.Rotate(r, 0.0, 0.0, 1.0);
                        GL.Translate(5 * g, 5 * f, 50 * r * h);
                        GL.Scale(h, h, h);
                        GL.Color4(0.2, 0.3 + 0.3 * r, 1.0, a);
                        GL.Rotate(h, 0.0, 1.0, 0);
                        GL.Begin(BeginMode.Quads);
                        {
                            GL.Vertex3(0, 0, 0); GL.TexCoord2(0, 0);
                            GL.Vertex3(10, 0, 0); GL.TexCoord2(1, 0);
                            GL.Vertex3(10, 10, 0); GL.TexCoord2(1, 1);
                            GL.Vertex3(0, 10, 0); GL.TexCoord2(0, 1);
                        }
                        GL.End();
                    }
                    GL.PopMatrix();
                }
                GL.PopMatrix();
            }
コード例 #2
0
ファイル: SpriteBase.cs プロジェクト: peges/hungry
 protected virtual void Draw()
 {
     // Handle invalidation here:
     if (_TileX != FrameCurrent.TileX)
     {
         FrameCurrent.TileX = _TileX;
         FrameCurrent.Build();                 // Invalidation
     }
     GL.Color4(_Color);
     Texture.Bind();            // Bind to (current) sprite texture
     FrameCurrent.VBO.Render(); // Render the vertex buffer object
     if (Configuration.DrawBlueprints /*&& BPVBO != null*/)
     {
         GL.BindTexture(TextureTarget.Texture2D, 0); // Unbind
         //BPVBO.Render(); // Render blueprint objects
         if (_Blueprints != null)
         {
             foreach (IRenderable r in _Blueprints)
             {
                 r.Render(0.0);
             }
         }
     }
 }
コード例 #3
0
 public virtual void Draw()
 {
     GL.Color4(Color.White);
     Texture.Bind(); // Bind to (current) sprite texture
     VBO.Render();   // Render the vertex buffer object
 }
コード例 #4
0
 protected override void Draw()
 {
     GL.Color4(State ? _Color : Color.SlateGray);
     Texture.Bind();
     FrameCurrent.VBO.Render();
 }