コード例 #1
0
        private void AddedNewGroup(int groupno, GLBuffer matrixbuffer)      // callback due to new group added, we need a texture and a RI
        {
            var texture = new GLTexture2DArray();

            items.Add(texture);
            texture.CreateOrUpdateTexture(bitmapsize.Width, bitmapsize.Height, matrixbuffers.Matricesperbuffer, textureformat, texmipmaplevels);
            grouptextureslist.Add(texture); // need to keep these for later addition

            var rd             = new RenderData(texture);
            var renderableItem = GLRenderableItem.CreateMatrix4(items, OpenTK.Graphics.OpenGL4.PrimitiveType.Quads, renderstate, matrixbuffer, 0, 4, rd, ic: 0);     //drawcount=4 (4 vertexes made up by shader), ic will be set in Add.

            renderlist.Add(shader, name + ":" + groupno, renderableItem);
            grouprenderlist.Add(renderableItem);
        }
コード例 #2
0
        public DynamicGridCoordVertexShader(Font f = null)
        {
            texcoords = new GLTexture2DArray();
            texcoords.CreateOrUpdateTexture(200, 25, 9, OpenTK.Graphics.OpenGL4.SizedInternalFormat.Rgba8);        // size and number, and the texcoord will own them, so it will dispose of them

            gridfnt = f ?? new Font("MS Sans Serif", 16);

            for (int i = 0; i < 9; i++)
            {
                Bitmap bmp = new Bitmap(texcoords.Width, texcoords.Height); // a bitmap for each number
                texcoords.LoadBitmap(bmp, i, true, 1);
            }

            CompileLink(OpenTK.Graphics.OpenGL4.ShaderType.VertexShader, vcode());
        }