예제 #1
0
        private void AddData(OpenGL gl)
        {
            var axis          = new Axis(2);
            var axisLineWidth = 4;

            LinesBufferGroup groupAxisX = new LinesBufferGroup(gl);
            LinesBufferGroup groupAxisY = new LinesBufferGroup(gl);
            LinesBufferGroup groupAxisZ = new LinesBufferGroup(gl);

            groupAxisX.LineWidth = axisLineWidth;
            groupAxisY.LineWidth = axisLineWidth;
            groupAxisZ.LineWidth = axisLineWidth;

            var vertsX = axis.LineX.Item1.to_array().Concat(axis.LineX.Item2.to_array()).ToArray();
            var vertsY = axis.LineY.Item1.to_array().Concat(axis.LineY.Item2.to_array()).ToArray();
            var vertsZ = axis.LineZ.Item1.to_array().Concat(axis.LineZ.Item2.to_array()).ToArray();

            groupAxisX.BufferData(gl, null, vertsX, new ColorF(255, 255, 0, 0));
            groupAxisY.BufferData(gl, null, vertsY, new ColorF(255, 0, 255, 0));
            groupAxisZ.BufferData(gl, null, vertsZ, new ColorF(255, 0, 0, 255));

            groupAxisX.PrepareVAO(gl, SCProgram);
            groupAxisY.PrepareVAO(gl, SCProgram);
            groupAxisZ.PrepareVAO(gl, SCProgram);

            SCProgram.AddBufferGroup(groupAxisX);
            SCProgram.AddBufferGroup(groupAxisY);
            SCProgram.AddBufferGroup(groupAxisZ);


            LinesBufferGroup groupGrid = new LinesBufferGroup(gl);
            var grid = new SquareGrid(5, 1);

            groupGrid.LineWidth = 1;

            //var vertsGrid = grid.Lines.SelectMany(x => x.Item1.to_array().Concat(x.Item2.to_array())).ToArray();
            var vertsGrid = grid.Lines.SelectMany(x => x.to_array()).ToArray();

            groupGrid.BufferData(gl, null, vertsGrid, new ColorF(255, 0, 0, 0));
            groupGrid.PrepareVAO(gl, SCProgram);

            SCProgram.AddBufferGroup(groupGrid);
        }
예제 #2
0
        private void AddData(OpenGL gl)
        {
            var axis = new Axis(2);
            var axisLineWidth = 4;

            LinesBufferGroup groupAxisX = new LinesBufferGroup(gl);
            LinesBufferGroup groupAxisY = new LinesBufferGroup(gl);
            LinesBufferGroup groupAxisZ = new LinesBufferGroup(gl);

            groupAxisX.LineWidth = axisLineWidth;
            groupAxisY.LineWidth = axisLineWidth;
            groupAxisZ.LineWidth = axisLineWidth;

            var vertsX = axis.LineX.Item1.to_array().Concat(axis.LineX.Item2.to_array()).ToArray();
            var vertsY = axis.LineY.Item1.to_array().Concat(axis.LineY.Item2.to_array()).ToArray();
            var vertsZ = axis.LineZ.Item1.to_array().Concat(axis.LineZ.Item2.to_array()).ToArray();

            groupAxisX.BufferData(gl, null, vertsX, new ColorF(255, 255, 0, 0));
            groupAxisY.BufferData(gl, null, vertsY, new ColorF(255, 0, 255, 0));
            groupAxisZ.BufferData(gl, null, vertsZ, new ColorF(255, 0, 0, 255));

            groupAxisX.PrepareVAO(gl, SCProgram);
            groupAxisY.PrepareVAO(gl, SCProgram);
            groupAxisZ.PrepareVAO(gl, SCProgram);

            SCProgram.AddBufferGroup(groupAxisX);
            SCProgram.AddBufferGroup(groupAxisY);
            SCProgram.AddBufferGroup(groupAxisZ);

            LinesBufferGroup groupGrid = new LinesBufferGroup(gl);
            var grid = new SquareGrid(5, 1);

            groupGrid.LineWidth = 1;

            //var vertsGrid = grid.Lines.SelectMany(x => x.Item1.to_array().Concat(x.Item2.to_array())).ToArray();
            var vertsGrid = grid.Lines.SelectMany(x => x.to_array()).ToArray();

            groupGrid.BufferData(gl, null, vertsGrid, new ColorF(255, 0, 0, 0));
            groupGrid.PrepareVAO(gl, SCProgram);

            SCProgram.AddBufferGroup(groupGrid);
        }