Пример #1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            Closed += ShaderTest_Closed;

            gl3dcontroller = new Controller3D();
            gl3dcontroller.PaintObjects = ControllerDraw;
            gl3dcontroller.MatrixCalc.PerspectiveNearZDistance = 1f;
            gl3dcontroller.MatrixCalc.PerspectiveFarZDistance  = 1000f;
            gl3dcontroller.ZoomDistance = 20F;
            gl3dcontroller.Start(glwfc, new Vector3(0, 0, 0), new Vector3(110f, 0, 0f), 1F);

            gl3dcontroller.KeyboardTravelSpeed = (ms, eyedist) =>
            {
                return((float)ms / 100.0f);
            };

            items.Add(new GLColorShaderWorld(), "COSW");

            var vs    = new GLPLVertexShaderColorModelObjectTranslation(new string[] { "modelpos" }, TransformFeedbackMode.InterleavedAttribs);
            var fs    = new GLPLFragmentShaderVSColor();
            var cosot = new GLShaderPipeline(vs, fs);

            items.Add(cosot, "COSOT");

            ts1 = new GLOperationQueryTimeStamp();
            ts2 = new GLOperationQueryTimeStamp();

            rObjects.Add(ts1);

            #region coloured lines

            GLRenderState def = new GLRenderState()
            {
                DepthTest = true
            };                                                                 // set up default state for fixed values - no depth test, rely on stencil

            sync = new GLOperationFenceSync();

            #region Coloured triangles
            if (true)
            {
                GLRenderState rc = GLRenderState.Tri(def);
                rc.CullFace = true;


                var shape = GLCubeObjectFactory.CreateSolidCubeFromTriangles(5f);
                rObjects.Add(cosot, "Tri1",
                             GLRenderableItem.CreateVector4Color4(items, PrimitiveType.Triangles, rc,
                                                                  shape,
                                                                  new Color4[] { Color4.Red, Color4.Red, Color4.Red, Color4.Red, Color4.Yellow, Color4.Yellow },
                                                                  new GLRenderDataTranslationRotation(new Vector3(10, 3, 20))
                                                                  ));
            }


            for (int i = 0; i < 1000; i++)
            {
                GLRenderState lines = GLRenderState.Lines(def, 5);

                rObjects.Add(items.Shader("COSW"),
                             GLRenderableItem.CreateVector4Color4(items, PrimitiveType.Lines, lines,
                                                                  GLShapeObjectFactory.CreateLines(new Vector3(-100, -0, -100), new Vector3(-100, -0, 100), new Vector3(10, 0, 0), 21),
                                                                  new Color4[] { Color.White, Color.Red, Color.DarkRed, Color.DarkRed })
                             );

                GLRenderState lines2 = GLRenderState.Lines(def, 1);

                rObjects.Add(items.Shader("COSW"),
                             GLRenderableItem.CreateVector4Color4(items, PrimitiveType.Lines, lines2,
                                                                  GLShapeObjectFactory.CreateLines(new Vector3(-100, -0, -100), new Vector3(100, -0, -100), new Vector3(0, 0, 10), 21),
                                                                  new Color4[] { Color.Orange, Color.Blue, Color.DarkRed, Color.DarkRed }));

                rObjects.Add(items.Shader("COSW"),
                             GLRenderableItem.CreateVector4Color4(items, PrimitiveType.Lines, lines2,
                                                                  GLShapeObjectFactory.CreateLines(new Vector3(-100, 10, -100), new Vector3(-100, 10, 100), new Vector3(10, 0, 0), 21),
                                                                  new Color4[] { Color.Yellow, Color.Orange, Color.Yellow, Color.Orange })
                             );

                rObjects.Add(items.Shader("COSW"),
                             GLRenderableItem.CreateVector4Color4(items, PrimitiveType.Lines, lines2,
                                                                  GLShapeObjectFactory.CreateLines(new Vector3(-100, 10, -100), new Vector3(100, 10, -100), new Vector3(0, 0, 10), 21),
                                                                  new Color4[] { Color.Yellow, Color.Orange, Color.Yellow, Color.Orange })
                             );
            }
            rObjects.Add(sync);
            rObjects.Add(ts2);

            #endregion


            #endregion

            #region Matrix Calc Uniform

            items.Add(new GLMatrixCalcUniformBlock(), "MCUB");     // def binding of 0

            #endregion
        }
Пример #2
0
        private void Controller3DDraw(Controller3D c3d, ulong time)
        {
            long t1 = hptimer.ElapsedTicks;
            //TBD
            //    GL.Finish();      // use GL finish to ensure last frame is done - if we are operating above sys tick rate, this will be small time. If we are rendering too much, it will stall
            long t2 = hptimer.ElapsedTicks;

            GLMatrixCalcUniformBlock mcb = ((GLMatrixCalcUniformBlock)items.UB("MCUB"));

            mcb.SetFull(gl3dcontroller.MatrixCalc);        // set the matrix unform block to the controller 3d matrix calc.

            // set up the grid shader size

            if (gridrenderable != null)
            {
                gridrenderable.InstanceCount = gridvertshader.ComputeGridSize(gl3dcontroller.MatrixCalc.EyeDistance, out lastgridwidth);
                lasteyedistance = gl3dcontroller.MatrixCalc.EyeDistance;

                gridvertshader.SetUniforms(gl3dcontroller.MatrixCalc.LookAt, lastgridwidth, gridrenderable.InstanceCount);
            }

            if (gridbitmapvertshader != null)
            {
                float coordfade = lastgridwidth == 10000 ? (0.7f - (c3d.MatrixCalc.EyeDistance / 20000).Clamp(0.0f, 0.7f)) : 0.7f;
                Color coordscol = Color.FromArgb(coordfade < 0.05 ? 0 : 150, Color.Cyan);
                gridbitmapvertshader.ComputeUniforms(lastgridwidth, gl3dcontroller.MatrixCalc, gl3dcontroller.PosCamera.CameraDirection, coordscol, Color.Transparent);
            }

            if (edsmgalmapregions != null)
            {
                edsmgalmapregions.SetY(gl3dcontroller.PosCamera.LookAt.Y);
            }

            if (elitemapregions != null)
            {
                elitemapregions.SetY(gl3dcontroller.PosCamera.LookAt.Y);
            }

            // set the coords fader


            // set the galaxy volumetric block

            if (galaxyrenderable != null)
            {
                galaxyrenderable.InstanceCount = volumetricblock.Set(gl3dcontroller.MatrixCalc, volumetricboundingbox, gl3dcontroller.MatrixCalc.InPerspectiveMode ? 50.0f  : 0);        // set up the volumentric uniform
                //System.Diagnostics.Debug.WriteLine("GI {0}", galaxyrendererable.InstanceCount);
                galaxyshader.SetDistance(gl3dcontroller.MatrixCalc.InPerspectiveMode ? c3d.MatrixCalc.EyeDistance : -1f);
            }

            long t3 = hptimer.ElapsedTicks;

            if (travelpath != null)
            {
                travelpath.Update(time, gl3dcontroller.MatrixCalc.EyeDistance);
            }

            if (galmapobjects != null)
            {
                galmapobjects.Update(time, gl3dcontroller.MatrixCalc.EyeDistance);
            }

            if (galaxystars != null)
            {
                galaxystars.Update(time, gl3dcontroller.MatrixCalc.EyeDistance);
            }

            if (galaxystars != null && gl3dcontroller.MatrixCalc.EyeDistance < 400)
            {
                galaxystars.Request9BoxConditional(gl3dcontroller.PosCamera.LookAt);
            }


            long t4 = hptimer.ElapsedTicks;

            //int[] queryID = new int[2];
            //GL.GenQueries(2, queryID);
            //GL.QueryCounter(queryID[0], QueryCounterTarget.Timestamp);

            var tmr1 = new GLOperationQueryTimeStamp();
            var tmr2 = new GLOperationQueryTimeStamp();

            tmr1.Execute(null);

            rObjects.Render(glwfc.RenderState, gl3dcontroller.MatrixCalc, verbose: false);
            tmr2.Execute(null);

            // GL.QueryCounter(queryID[1], QueryCounterTarget.Timestamp);

            //   GL.Flush(); // ensure everything is in the grapghics pipeline

            //while (tmr2.IsAvailable() == false)
            //    ;

            long a = tmr1.GetCounter();
            long b = tmr2.GetCounter();

            //int done = 0;
            //while (done == 0)
            //{
            //    GL.GetQueryObject(queryID[1], GetQueryObjectParam.QueryResultAvailable, out done);
            //}

            //GL.GetQueryObject(queryID[0], GetQueryObjectParam.QueryResult, out long a);
            //GL.GetQueryObject(queryID[1], GetQueryObjectParam.QueryResult, out long b);
            //System.Diagnostics.Debug.WriteLine($"timer {a} {b} {b-a}" );

            long t5 = hptimer.ElapsedTicks;

            if (debugbuffer != null)
            {
                GLMemoryBarrier.All();
                Vector4[] debugout = debugbuffer.ReadVector4s(0, 4);
                System.Diagnostics.Debug.WriteLine("{0},{1},{2},{3}", debugout[0], debugout[1], debugout[2], debugout[3]);
            }

            long t    = hptimer.ElapsedMilliseconds;
            long diff = t - lastms;

            for (int i = frametimes.Length - 1; i > 0; i--)
            {
                frametimes[i] = frametimes[i - 1];
            }

            frametimes[0] = diff;

            lastms = t;
            double fps = (1000.0 / diff);

            if (fpsavg <= 1)
            {
                fpsavg = fps;
            }
            else
            {
                fpsavg = (fpsavg * 0.95) + fps * 0.05;
            }

            tmr1.Dispose();
            tmr2.Dispose();
            if (diff > 0)
            {
//                System.Diagnostics.Debug.Write($"Frame {hptimer.ElapsedMilliseconds,6} {diff,3} fps {fpsavg:#.0} frames {frametimes[0],3} {frametimes[1],3} {frametimes[2],3} {frametimes[3],3} {frametimes[4],3} {frametimes[5],3} sec {galaxystars.Sectors,3}");
//                System.Diagnostics.Debug.WriteLine($" finish {(t2 - t1) * 1000000 / Stopwatch.Frequency,5} t3 {(t3 - t2) * 1000000 / Stopwatch.Frequency,4} t4 {(t4 - t3) * 1000000 / Stopwatch.Frequency,4} render {(t5 - t4) * 1000000 / Stopwatch.Frequency,5} tot {(t5 - t1) * 1000000 / Stopwatch.Frequency,5}");
            }
            //            this.Text = "FPS " + fpsavg.ToString("N0") + " Looking at " + gl3dcontroller.MatrixCalc.TargetPosition + " eye@ " + gl3dcontroller.MatrixCalc.EyePosition + " dir " + gl3dcontroller.Pos.CameraDirection + " Dist " + gl3dcontroller.MatrixCalc.EyeDistance + " Zoom " + gl3dcontroller.Pos.ZoomFactor;
        }
Пример #3
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            Closed += ShaderTest_Closed;

            gl3dcontroller = new Controller3D();
            gl3dcontroller.PaintObjects = ControllerDraw;
            gl3dcontroller.MatrixCalc.PerspectiveNearZDistance = 1f;
            gl3dcontroller.MatrixCalc.PerspectiveFarZDistance  = 1000f;
            gl3dcontroller.ZoomDistance = 20F;
            gl3dcontroller.Start(glwfc, new Vector3(0, 0, 0), new Vector3(110f, 0, 0f), 1F);

            gl3dcontroller.KeyboardTravelSpeed = (ms, eyedist) =>
            {
                return((float)ms / 100.0f);
            };

            items.Add(new GLTexturedShaderObjectTranslation(), "TEXOT");
            items.Add(new GLTexturedShaderObjectTranslation(), "TEXOTNoRot");
            items.Add(new GLColorShaderWorld(), "COSW");
            items.Add(new GLColorShaderObjectTranslation(), "COSOT");
            items.Add(new GLFixedColorShaderObjectTranslation(Color.Goldenrod), "FCOSOT");
            items.Add(new GLTexturedShaderObjectCommonTranslation(), "TEXOCT");

            items.Add(new GLTexture2D(Properties.Resources.dotted2, SizedInternalFormat.Rgba8), "dotted");
            items.Add(new GLTexture2D(Properties.Resources.Logo8bpp, SizedInternalFormat.Rgba8), "logo8bpp");

            items.Add(new GLTexture2D(Properties.Resources.wooden, SizedInternalFormat.Rgba8), "wooden");
            items.Add(new GLTexture2D(Properties.Resources.shoppinglist, SizedInternalFormat.Rgba8), "shoppinglist");
            items.Add(new GLTexture2D(Properties.Resources.golden, SizedInternalFormat.Rgba8), "golden");
            items.Add(new GLTexture2D(Properties.Resources.smile5300_256x256x8, SizedInternalFormat.Rgba8), "smile");
            items.Add(new GLTexture2D(Properties.Resources.moonmap1k, SizedInternalFormat.Rgba8), "moon");


            ts1 = new GLOperationQueryTimeStamp();
            ts2 = new GLOperationQueryTimeStamp();

            rObjects.Add(ts1);

            #region coloured lines

            GLRenderState def = new GLRenderState()
            {
                DepthTest = true
            };                                                                 // set up default state for fixed values - no depth test, rely on stencil

            GLBuffer querybuffer = new GLBuffer(128, true);

            #region Coloured triangles
            if (true)
            {
                GLRenderState rc = GLRenderState.Tri(def);
                rc.CullFace = true;

                // Lets demo the query buffer!

                var q1 = new GLOperationQuery(OpenTK.Graphics.OpenGL4.QueryTarget.PrimitivesGenerated, 0, true, querybuffer);
                items.Add(q1);
                rObjects.Add(q1);

                var q2 = new GLOperationQuery(OpenTK.Graphics.OpenGL4.QueryTarget.SamplesPassed, 0, false, querybuffer);
                items.Add(q2);
                rObjects.Add(q2);

                rObjects.Add(items.Shader("COSOT"), "Tri1",
                             GLRenderableItem.CreateVector4Color4(items, PrimitiveType.Triangles, rc,
                                                                  GLCubeObjectFactory.CreateSolidCubeFromTriangles(5f),
                                                                  new Color4[] { Color4.Red, Color4.Red, Color4.Red, Color4.Red, Color4.Yellow, Color4.Yellow },
                                                                  new GLRenderDataTranslationRotation(new Vector3(10, 3, 20))
                                                                  ));

                rObjects.Add(new GLOperationEndQuery(q2, querycomplete: (t) =>
                {
                    //    int v = t.GetQuery(OpenTK.Graphics.OpenGL4.GetQueryObjectParam.QueryResult);
                    t.UpdateBuffer(0);
                    //System.Diagnostics.Debug.WriteLine($"Samples for first {v}");
                }));

                rObjects.Add(new GLOperationEndQuery(q1, querycomplete: (t) =>
                {
                    t.UpdateBuffer(16);
                    int[] ints = querybuffer.ReadInts(0, 8);
                    System.Diagnostics.Debug.WriteLine($"Samples {ints[0]} Prims {ints[4]}");
                }));

                rObjects.Add(new GLOperationEndQueryBuffer());      // must turn off otherwise it goes awol next loop
            }



            for (int i = 0; i < 1; i++)
            {
                GLRenderState lines = GLRenderState.Lines(def, 5);

                rObjects.Add(items.Shader("COSW"),
                             GLRenderableItem.CreateVector4Color4(items, PrimitiveType.Lines, lines,
                                                                  GLShapeObjectFactory.CreateLines(new Vector3(-100, -0, -100), new Vector3(-100, -0, 100), new Vector3(10, 0, 0), 21),
                                                                  new Color4[] { Color.White, Color.Red, Color.DarkRed, Color.DarkRed })
                             );

                GLRenderState lines2 = GLRenderState.Lines(def, 1);

                rObjects.Add(items.Shader("COSW"),
                             GLRenderableItem.CreateVector4Color4(items, PrimitiveType.Lines, lines2,
                                                                  GLShapeObjectFactory.CreateLines(new Vector3(-100, -0, -100), new Vector3(100, -0, -100), new Vector3(0, 0, 10), 21),
                                                                  new Color4[] { Color.Orange, Color.Blue, Color.DarkRed, Color.DarkRed }));

                rObjects.Add(items.Shader("COSW"),
                             GLRenderableItem.CreateVector4Color4(items, PrimitiveType.Lines, lines2,
                                                                  GLShapeObjectFactory.CreateLines(new Vector3(-100, 10, -100), new Vector3(-100, 10, 100), new Vector3(10, 0, 0), 21),
                                                                  new Color4[] { Color.Yellow, Color.Orange, Color.Yellow, Color.Orange })
                             );

                rObjects.Add(items.Shader("COSW"),
                             GLRenderableItem.CreateVector4Color4(items, PrimitiveType.Lines, lines2,
                                                                  GLShapeObjectFactory.CreateLines(new Vector3(-100, 10, -100), new Vector3(100, 10, -100), new Vector3(0, 0, 10), 21),
                                                                  new Color4[] { Color.Yellow, Color.Orange, Color.Yellow, Color.Orange })
                             );
            }

            rObjects.Add(ts2);

            #endregion


            #endregion

            #region Matrix Calc Uniform

            items.Add(new GLMatrixCalcUniformBlock(), "MCUB");     // def binding of 0

            #endregion
        }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            Closed += ShaderTest_Closed;

            gl3dcontroller = new Controller3D();
            gl3dcontroller.PaintObjects = ControllerDraw;
            gl3dcontroller.MatrixCalc.PerspectiveNearZDistance = 1f;
            gl3dcontroller.MatrixCalc.PerspectiveFarZDistance  = 1000f;
            gl3dcontroller.ZoomDistance = 20F;
            gl3dcontroller.Start(glwfc, new Vector3(0, 0, 0), new Vector3(110f, 0, 0f), 1F);

            gl3dcontroller.KeyboardTravelSpeed = (ms, eyedist) =>
            {
                return((float)ms / 100.0f);
            };

            items.Add(new GLTexturedShaderObjectTranslation(), "TEXOT");
            items.Add(new GLTexturedShaderObjectTranslation(), "TEXOTNoRot");
            items.Add(new GLColorShaderWorld(), "COSW");
            items.Add(new GLColorShaderObjectTranslation(), "COSOT");
            items.Add(new GLFixedColorShaderObjectTranslation(Color.Goldenrod), "FCOSOT");
            items.Add(new GLTexturedShaderObjectCommonTranslation(), "TEXOCT");

            items.Add(new GLTexture2D(Properties.Resources.dotted2, SizedInternalFormat.Rgba8), "dotted");
            items.Add(new GLTexture2D(Properties.Resources.Logo8bpp, SizedInternalFormat.Rgba8), "logo8bpp");

            items.Add(new GLTexture2D(Properties.Resources.wooden, SizedInternalFormat.Rgba8), "wooden");
            items.Add(new GLTexture2D(Properties.Resources.shoppinglist, SizedInternalFormat.Rgba8), "shoppinglist");
            items.Add(new GLTexture2D(Properties.Resources.golden, SizedInternalFormat.Rgba8), "golden");
            items.Add(new GLTexture2D(Properties.Resources.smile5300_256x256x8, SizedInternalFormat.Rgba8), "smile");
            items.Add(new GLTexture2D(Properties.Resources.moonmap1k, SizedInternalFormat.Rgba8), "moon");


            ts1 = new GLOperationQueryTimeStamp();
            ts2 = new GLOperationQueryTimeStamp();

            rObjects.Add(ts1);

            #region coloured lines

            GLRenderState def = new GLRenderState()
            {
                DepthTest = true
            };                                                                 // set up default state for fixed values - no depth test, rely on stencil

            #region Coloured triangles
            if (true)
            {
                GLRenderState rc = GLRenderState.Tri(def);
                rc.CullFace = true;

                var q1 = new GLOperationQuery(OpenTK.Graphics.OpenGL4.QueryTarget.PrimitivesGenerated, 0, true);
                q1.FinishAction += (t) => { System.Diagnostics.Debug.WriteLine($"What is Query for Primities Gen? {GLOperationQuery.GetQueryName(OpenTK.Graphics.OpenGL4.QueryTarget.PrimitivesGenerated, 0)}"); };
                items.Add(q1);
                rObjects.Add(q1);

                var q2 = new GLOperationQuery(OpenTK.Graphics.OpenGL4.QueryTarget.SamplesPassed);
                items.Add(q2);
                rObjects.Add(q2);

                rObjects.Add(items.Shader("COSOT"), "Tri1",
                             GLRenderableItem.CreateVector4Color4(items, PrimitiveType.Triangles, rc,
                                                                  GLCubeObjectFactory.CreateSolidCubeFromTriangles(5f),
                                                                  new Color4[] { Color4.Red, Color4.Red, Color4.Red, Color4.Red, Color4.Cyan, Color4.Orange },
                                                                  new GLRenderDataTranslationRotation(new Vector3(10, 3, 20))
                                                                  ));

                rObjects.Add(new GLOperationEndQuery(q2, querycomplete: (t) =>
                {
                    int v = t.GetQuery(OpenTK.Graphics.OpenGL4.GetQueryObjectParam.QueryResult);
                    System.Diagnostics.Debug.WriteLine($"Samples for first {v}");

                    t.BeginConditional(ConditionalRenderType.QueryWait);
                }));

                // this box dissappears when other is not painted

                rObjects.Add(items.Shader("COSOT"), "Tri2",
                             GLRenderableItem.CreateVector4Color4(items, PrimitiveType.Triangles, rc,
                                                                  GLCubeObjectFactory.CreateSolidCubeFromTriangles(5f),
                                                                  new Color4[] { Color4.Green, Color4.Green, Color4.Green, Color4.Green, Color4.Cyan, Color4.Orange },
                                                                  new GLRenderDataTranslationRotation(new Vector3(-50, 3, 20))
                                                                  ), atend: true);

                rObjects.Add(items.Shader("COSOT"), new GLOperationEndConditionalRender(), true);     // note the attach as a renderable item, to demo it works

                rObjects.Add(new GLOperationEndQuery(q1, querycomplete: (t) =>
                {
                    int v = t.GetQuery(OpenTK.Graphics.OpenGL4.GetQueryObjectParam.QueryResult);
                    System.Diagnostics.Debug.WriteLine($"Primitives for both boxes {v}");
                }));
            }



            for (int i = 0; i < 1; i++)  //if (true)
            {
                GLRenderState lines = GLRenderState.Lines(def, 5);

                rObjects.Add(items.Shader("COSW"),
                             GLRenderableItem.CreateVector4Color4(items, PrimitiveType.Lines, lines,
                                                                  GLShapeObjectFactory.CreateLines(new Vector3(-100, -0, -100), new Vector3(-100, -0, 100), new Vector3(10, 0, 0), 21),
                                                                  new Color4[] { Color.White, Color.Red, Color.DarkRed, Color.DarkRed })
                             );

                GLRenderState lines2 = GLRenderState.Lines(def, 1);

                rObjects.Add(items.Shader("COSW"),
                             GLRenderableItem.CreateVector4Color4(items, PrimitiveType.Lines, lines2,
                                                                  GLShapeObjectFactory.CreateLines(new Vector3(-100, -0, -100), new Vector3(100, -0, -100), new Vector3(0, 0, 10), 21),
                                                                  new Color4[] { Color.Orange, Color.Blue, Color.DarkRed, Color.DarkRed }));

                rObjects.Add(items.Shader("COSW"),
                             GLRenderableItem.CreateVector4Color4(items, PrimitiveType.Lines, lines2,
                                                                  GLShapeObjectFactory.CreateLines(new Vector3(-100, 10, -100), new Vector3(-100, 10, 100), new Vector3(10, 0, 0), 21),
                                                                  new Color4[] { Color.Yellow, Color.Orange, Color.Yellow, Color.Orange })
                             );

                rObjects.Add(items.Shader("COSW"),
                             GLRenderableItem.CreateVector4Color4(items, PrimitiveType.Lines, lines2,
                                                                  GLShapeObjectFactory.CreateLines(new Vector3(-100, 10, -100), new Vector3(100, 10, -100), new Vector3(0, 0, 10), 21),
                                                                  new Color4[] { Color.Yellow, Color.Orange, Color.Yellow, Color.Orange })
                             );
            }

            rObjects.Add(ts2);

            #endregion


            #endregion

            #region Matrix Calc Uniform

            items.Add(new GLMatrixCalcUniformBlock(), "MCUB");     // def binding of 0

            #endregion
        }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            Closed += ShaderTest_Closed;

            System.Management.ManagementObjectSearcher searcher = new System.Management.ManagementObjectSearcher("SELECT * FROM Win32_VideoController");

            foreach (var obj in searcher.Get())
            {
                var bpp = obj.Properties["CurrentBitsPerPixel"];
                if (bpp != null)
                {
                    var name = obj.Properties["Name"];
                    var ver  = obj.Properties["DriverVersion"];
                }
            }


            gl3dcontroller = new Controller3D();
            gl3dcontroller.PaintObjects = ControllerDraw;
            gl3dcontroller.MatrixCalc.PerspectiveNearZDistance = 1f;
            gl3dcontroller.MatrixCalc.PerspectiveFarZDistance  = 1000f;
            gl3dcontroller.ZoomDistance = 20F;
            gl3dcontroller.Start(glwfc, new Vector3(0, 0, 0), new Vector3(110f, 0, 0f), 1F);

            gl3dcontroller.KeyboardTravelSpeed = (ms, eyedist) =>
            {
                return((float)ms / 100.0f);
            };

            items.Add(new GLColorShaderWorld(), "COSW");

            var vs1   = new GLPLVertexShaderColorModelObjectTranslation(new string[] { "modelpos" }, TransformFeedbackMode.InterleavedAttribs);
            var vsbin = vs1.GetBinary(out BinaryFormat binformat);      // round trip example thru binary

            var vs = new GLPLVertexShaderColorModelObjectTranslation(vsbin, binformat);

            var fs    = new GLPLFragmentShaderVSColor(true);
            var cosot = new GLShaderPipeline(vs, fs);

            var pipelinebin = cosot.GetBinary(out BinaryFormat fmt);    // save out a pipeline shader

            var cosotloaded = new GLShaderPipeline(pipelinebin, fmt);   // demo you can load them, but can't be used, since we then don't have all the component classes


            items.Add(cosot, "COSOT");

            ts1 = new GLOperationQueryTimeStamp();
            ts2 = new GLOperationQueryTimeStamp();

            rObjects.Add(ts1);

            #region coloured lines

            GLRenderState def = new GLRenderState()
            {
                DepthTest = true
            };                                                                 // set up default state for fixed values - no depth test, rely on stencil

            #region Coloured triangles
            if (true)
            {
                GLRenderState rc = GLRenderState.Tri(def);
                rc.CullFace = true;


                var shape = GLCubeObjectFactory.CreateSolidCubeFromTriangles(5f);
                rObjects.Add(cosot, "Tri1",
                             GLRenderableItem.CreateVector4Color4(items, PrimitiveType.Triangles, rc,
                                                                  shape,
                                                                  new Color4[] { Color4.Red, Color4.Red, Color4.Red, Color4.Red, Color4.Yellow, Color4.Yellow },
                                                                  new GLRenderDataTranslationRotation(new Vector3(10, 3, 20))
                                                                  ));
            }


            for (int i = 0; i < 1; i++)
            {
                GLRenderState lines = GLRenderState.Lines(def, 5);

                rObjects.Add(items.Shader("COSW"),
                             GLRenderableItem.CreateVector4Color4(items, PrimitiveType.Lines, lines,
                                                                  GLShapeObjectFactory.CreateLines(new Vector3(-100, -0, -100), new Vector3(-100, -0, 100), new Vector3(10, 0, 0), 21),
                                                                  new Color4[] { Color.White, Color.Red, Color.DarkRed, Color.DarkRed })
                             );

                GLRenderState lines2 = GLRenderState.Lines(def, 1);

                rObjects.Add(items.Shader("COSW"),
                             GLRenderableItem.CreateVector4Color4(items, PrimitiveType.Lines, lines2,
                                                                  GLShapeObjectFactory.CreateLines(new Vector3(-100, -0, -100), new Vector3(100, -0, -100), new Vector3(0, 0, 10), 21),
                                                                  new Color4[] { Color.Orange, Color.Blue, Color.DarkRed, Color.DarkRed }));

                rObjects.Add(items.Shader("COSW"),
                             GLRenderableItem.CreateVector4Color4(items, PrimitiveType.Lines, lines2,
                                                                  GLShapeObjectFactory.CreateLines(new Vector3(-100, 10, -100), new Vector3(-100, 10, 100), new Vector3(10, 0, 0), 21),
                                                                  new Color4[] { Color.Yellow, Color.Orange, Color.Yellow, Color.Orange })
                             );

                rObjects.Add(items.Shader("COSW"),
                             GLRenderableItem.CreateVector4Color4(items, PrimitiveType.Lines, lines2,
                                                                  GLShapeObjectFactory.CreateLines(new Vector3(-100, 10, -100), new Vector3(100, 10, -100), new Vector3(0, 0, 10), 21),
                                                                  new Color4[] { Color.Yellow, Color.Orange, Color.Yellow, Color.Orange })
                             );
            }

            rObjects.Add(ts2);

            #endregion


            #endregion

            #region Matrix Calc Uniform

            items.Add(new GLMatrixCalcUniformBlock(), "MCUB");     // def binding of 0

            #endregion
        }