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

            //GLStatics.EnableDebug(DebugProc);

            gl3dcontroller = new Controller3D();
            gl3dcontroller.PaintObjects = ControllerDraw;
            gl3dcontroller.MatrixCalc.PerspectiveNearZDistance = 0.1f;
            gl3dcontroller.ZoomDistance = 80F;
            gl3dcontroller.MouseRotateAmountPerPixel = 0.1f;

            gl3dcontroller.Start(glwfc, new Vector3(0, 0, 0), new Vector3(135, 0, 0), 1F);


            items.Add(new GLColorShaderWorld(), "COSW");
            GLRenderState rl1 = GLRenderState.Lines(1);

            {
                rObjects.Add(items.Shader("COSW"), "L1",   // horizontal
                             GLRenderableItem.CreateVector4Color4(items, PrimitiveType.Lines, rl1,
                                                                  GLShapeObjectFactory.CreateLines(new Vector3(-100, 0, -100), new Vector3(-100, 0, 100), new Vector3(10, 0, 0), 21),
                                                                  new Color4[] { Color.Gray })
                             );


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

            // Number markers using instancing and 2d arrays, each with its own transform
            {
                Bitmap[]  numbers   = new Bitmap[20];
                Matrix4[] numberpos = new Matrix4[20];

                Font fnt = new Font("Arial", 44);

                for (int i = 0; i < numbers.Length; i++)
                {
                    int v = -100 + i * 10;
                    numbers[i] = new Bitmap(100, 100);
                    GLOFC.Utils.BitMapHelpers.DrawTextCentreIntoBitmap(ref numbers[i], v.ToString(), fnt, System.Drawing.Text.TextRenderingHint.ClearTypeGridFit, Color.Red, Color.AliceBlue);
                    numberpos[i]  = Matrix4.CreateScale(1);
                    numberpos[i] *= Matrix4.CreateRotationX(-80f.Radians());
                    numberpos[i] *= Matrix4.CreateTranslation(new Vector3(20, 0, v));
                }

                GLTexture2DArray array = new GLTexture2DArray(numbers, SizedInternalFormat.Rgba8, ownbmp: true);
                items.Add(array, "Nums");
                items.Add(new GLShaderPipeline(new GLPLVertexShaderModelMatrixTexture(), new GLPLFragmentShaderTexture2DIndexed(0)), "IC-2");

                GLRenderState       rq = GLRenderState.Quads(cullface: false);
                GLRenderDataTexture rt = new GLRenderDataTexture(items.Tex("Nums"));

                rObjects.Add(items.Shader("IC-2"), "1-b",
                             GLRenderableItem.CreateVector4Vector2Matrix4(items, PrimitiveType.Quads, rq,
                                                                          GLShapeObjectFactory.CreateQuad(1.0f), GLShapeObjectFactory.TexQuadCW, numberpos, rt,
                                                                          numberpos.Length));
            }


            {
                int       left = -40, right = 40, bottom = -20, top = +20, front = -40, back = 40;
                Vector4[] lines2 = new Vector4[]
                {
                    new Vector4(left, bottom, front, 1), new Vector4(left, top, front, 1),
                    new Vector4(left, top, front, 1), new Vector4(right, top, front, 1),
                    new Vector4(right, top, front, 1), new Vector4(right, bottom, front, 1),
                    new Vector4(right, bottom, front, 1), new Vector4(left, bottom, front, 1),

                    new Vector4(left, bottom, back, 1), new Vector4(left, top, back, 1),
                    new Vector4(left, top, back, 1), new Vector4(right, top, back, 1),
                    new Vector4(right, top, back, 1), new Vector4(right, bottom, back, 1),
                    new Vector4(right, bottom, back, 1), new Vector4(left, bottom, back, 1),

                    new Vector4(left, bottom, front, 1), new Vector4(left, bottom, back, 1),
                    new Vector4(left, top, front, 1), new Vector4(left, top, back, 1),
                    new Vector4(right, bottom, front, 1), new Vector4(right, bottom, back, 1),
                    new Vector4(right, top, front, 1), new Vector4(right, top, back, 1),
                };

                items.Add(new GLFixedShader(System.Drawing.Color.Yellow), "LINEYELLOW");
                rObjects.Add(items.Shader("LINEYELLOW"),
                             GLRenderableItem.CreateVector4(items, PrimitiveType.Lines, rl1, lines2));
            }


            items.Add(new ShaderV2(), "V2");

            GLRenderState rltot = GLRenderState.Tri();

            rObjects.Add(items.Shader("V2"), GLRenderableItem.CreateNullVertex(PrimitiveType.Points, rltot, instancecount: slices));



            dataoutbuffer = items.NewStorageBlock(5);
            dataoutbuffer.AllocateBytes(sizeof(float) * 4 * 32, OpenTK.Graphics.OpenGL4.BufferUsageHint.DynamicRead);    // 32 vec4 back

            atomicbuffer = items.NewAtomicBlock(6);
            atomicbuffer.AllocateBytes(sizeof(float) * 32, OpenTK.Graphics.OpenGL4.BufferUsageHint.DynamicCopy);

            pointblock = items.NewUniformBlock(1);
            pointblock.AllocateBytes(sizeof(float) * 4 * 8 + sizeof(float) * 30);        // plenty of space

            int hsize = 40, vsize = 20, zsize = 40;

            boundingbox = new Vector4[]
            {
                new Vector4(-hsize, -vsize, -zsize, 1),
                new Vector4(-hsize, vsize, -zsize, 1),
                new Vector4(hsize, vsize, -zsize, 1),
                new Vector4(hsize, -vsize, -zsize, 1),

                new Vector4(-hsize, -vsize, zsize, 1),
                new Vector4(-hsize, vsize, zsize, 1),
                new Vector4(hsize, vsize, zsize, 1),
                new Vector4(hsize, -vsize, zsize, 1),
            };

            items.Add(new GLMatrixCalcUniformBlock(), "MCUB");      // create a matrix uniform block
        }