Esempio n. 1
0
        protected override void RenderModel(float elapsedMs)
        {
            GL.BindTexture(TextureTarget.Texture2D, NeuronTexture);

            const float halfSize = SpriteSize / 2;

            Color4 color = new Color4(255, 255, 255, (byte)(255 * m_alpha));

            GL.Enable(EnableCap.Texture2D);

            using (Blender.AveragingBlender())
            {
                GL.Color4(color);

                GL.Begin(PrimitiveType.Quads);
                GL.TexCoord2(0, 0);
                GL.Vertex2(-halfSize, -halfSize);
                GL.TexCoord2(1, 0);
                GL.Vertex2(halfSize, -halfSize);
                GL.TexCoord2(1, 1);
                GL.Vertex2(halfSize, halfSize);
                GL.TexCoord2(0, 1);
                GL.Vertex2(-halfSize, halfSize);
                GL.End();
            }

            GL.Disable(EnableCap.Texture2D);

            GL.BindTexture(TextureTarget.Texture2D, 0);
        }
Esempio n. 2
0
        protected override void RenderModel(float elapsedMs)
        {
            Vector3 fromPosition = From.CurrentWorldMatrix.ExtractTranslation();
            Vector3 toPosition   = To.CurrentWorldMatrix.ExtractTranslation();

            using (Blender.AveragingBlender())
            {
                GL.Color4(ConnectionColor);
                GL.Color4(Color.FromArgb(Math.Max((int)(255 * Alpha), 50), 255, 255, 255));
                GL.LineWidth(2f);

                GL.Begin(PrimitiveType.Lines);

                GL.Vertex3(fromPosition);
                GL.Vertex3(toPosition);

                GL.End();
            }
        }
Esempio n. 3
0
        protected override void RenderModel(float elapsedMs)
        {
            using (Blender.AveragingBlender())
            {
                GL.LineWidth(1f);
                GL.Begin(PrimitiveType.Lines);

                for (int i = 0; i < m_width; i++)
                {
                    for (int j = 0; j < m_depth; j++)
                    {
                        int x = m_xStart + (i * m_cellSize);
                        int y = 0;
                        int z = m_yStart + (j * m_cellSize);


                        GL.Color4(j == m_depth / 2 ? m_baseLineColor : m_lineColor);

                        GL.Vertex3(x, y, z);
                        GL.Vertex3(x + m_cellSize, y, z);


                        GL.Color4(i == m_width / 2 ? m_baseLineColor : m_lineColor);

                        GL.Vertex3(x, y, z);
                        GL.Vertex3(x, y, z + m_cellSize);
                    }
                }
                GL.End();

                if (!DrawAxes)
                {
                    return;
                }

                DrawAxis(new Vector3(1, 0, 0), Color4.Red);
                DrawAxis(new Vector3(0, 1, 0), Color4.Blue);
                DrawAxis(new Vector3(0, 0, 1), Color4.Green);
            }
        }
        protected override void RenderModel(float elapsedMs)
        {
            using (Blender.AveragingBlender())
            {
                // Draw the body.

                GL.Color4(Color);

                GL.Begin(PrimitiveType.Quads);

                GL.Vertex3(-HalfSize.X, -HalfSize.Y, -HalfSize.Z);
                GL.Vertex3(HalfSize.X, -HalfSize.Y, -HalfSize.Z);
                GL.Vertex3(HalfSize.X, HalfSize.Y, -HalfSize.Z);
                GL.Vertex3(-HalfSize.X, HalfSize.Y, -HalfSize.Z);

                GL.Vertex3(-HalfSize.X, -HalfSize.Y, HalfSize.Z);
                GL.Vertex3(HalfSize.X, -HalfSize.Y, HalfSize.Z);
                GL.Vertex3(HalfSize.X, HalfSize.Y, HalfSize.Z);
                GL.Vertex3(-HalfSize.X, HalfSize.Y, HalfSize.Z);

                GL.Vertex3(-HalfSize.X, -HalfSize.Y, -HalfSize.Z);
                GL.Vertex3(-HalfSize.X, HalfSize.Y, -HalfSize.Z);
                GL.Vertex3(-HalfSize.X, HalfSize.Y, HalfSize.Z);
                GL.Vertex3(-HalfSize.X, -HalfSize.Y, HalfSize.Z);

                GL.Vertex3(HalfSize.X, -HalfSize.Y, -HalfSize.Z);
                GL.Vertex3(HalfSize.X, HalfSize.Y, -HalfSize.Z);
                GL.Vertex3(HalfSize.X, HalfSize.Y, HalfSize.Z);
                GL.Vertex3(HalfSize.X, -HalfSize.Y, HalfSize.Z);

                GL.Vertex3(-HalfSize.X, -HalfSize.Y, -HalfSize.Z);
                GL.Vertex3(HalfSize.X, -HalfSize.Y, -HalfSize.Z);
                GL.Vertex3(HalfSize.X, -HalfSize.Y, HalfSize.Z);
                GL.Vertex3(-HalfSize.X, -HalfSize.Y, HalfSize.Z);

                GL.Vertex3(-HalfSize.X, HalfSize.Y, -HalfSize.Z);
                GL.Vertex3(HalfSize.X, HalfSize.Y, -HalfSize.Z);
                GL.Vertex3(HalfSize.X, HalfSize.Y, HalfSize.Z);
                GL.Vertex3(-HalfSize.X, HalfSize.Y, HalfSize.Z);

                GL.End();

                // Draw the borders.

                GL.Color4(0.7f, 0.7f, 0.7f, 0.1f);
                GL.LineWidth(2f);

                GL.Begin(PrimitiveType.LineLoop);

                GL.Vertex3(-HalfSize.X, -HalfSize.Y, -HalfSize.Z);
                GL.Vertex3(-HalfSize.X, -HalfSize.Y, HalfSize.Z);
                GL.Vertex3(-HalfSize.X, HalfSize.Y, HalfSize.Z);
                GL.Vertex3(-HalfSize.X, HalfSize.Y, -HalfSize.Z);

                GL.End();

                GL.Begin(PrimitiveType.LineLoop);

                GL.Vertex3(HalfSize.X, -HalfSize.Y, -HalfSize.Z);
                GL.Vertex3(HalfSize.X, -HalfSize.Y, HalfSize.Z);
                GL.Vertex3(HalfSize.X, HalfSize.Y, HalfSize.Z);
                GL.Vertex3(HalfSize.X, HalfSize.Y, -HalfSize.Z);

                GL.End();

                GL.Begin(PrimitiveType.Lines);

                GL.Vertex3(-HalfSize.X, -HalfSize.Y, -HalfSize.Z);
                GL.Vertex3(HalfSize.X, -HalfSize.Y, -HalfSize.Z);

                GL.Vertex3(-HalfSize.X, HalfSize.Y, HalfSize.Z);
                GL.Vertex3(HalfSize.X, HalfSize.Y, HalfSize.Z);

                GL.Vertex3(-HalfSize.X, -HalfSize.Y, HalfSize.Z);
                GL.Vertex3(HalfSize.X, -HalfSize.Y, HalfSize.Z);

                GL.Vertex3(-HalfSize.X, HalfSize.Y, -HalfSize.Z);
                GL.Vertex3(HalfSize.X, HalfSize.Y, -HalfSize.Z);

                GL.End();
            }
        }