Пример #1
0
        /// <summary>
        /// OpenGL rendering code itself (separated for clarity).
        /// </summary>
        private void RenderScene()
        {
            // Simulation scene rendering.
            MarblesRenderData rdata = null;

            if (renderer != null &&
                OGL.useShaders)
            {
                lock (renderer)
                    rdata = data;
            }

            if (rdata != null)
            {
                OGL.FormData();

                // Simulated scene.
                primitiveCounter += renderer.Render(OGL, rdata);

                // Light source.
                GL.PointSize(5.0f);
                GL.Begin(PrimitiveType.Points);
                GL.Color3(1.0f, 1.0f, 1.0f);
                GL.Vertex3(OGL.lightPosition);
                GL.End();

                primitiveCounter++;

                primitiveCounter += rdata.Cube.Draw();
            }
            else
            {
                CubeObject cube = new CubeObject(10);
                primitiveCounter += cube.Draw();
            }
        }
Пример #2
0
 public MarblesRenderData(CubeObject walls, IEnumerable <SphereObject> spheres)
 {
     Cube    = walls;
     Spheres = new List <SphereObject>(spheres);
 }