當前位置: 首頁>>代碼示例>>C#>>正文


C# OpenGL.GenVertexArrays方法代碼示例

本文整理匯總了C#中SharpGL.OpenGL.GenVertexArrays方法的典型用法代碼示例。如果您正苦於以下問題:C# OpenGL.GenVertexArrays方法的具體用法?C# OpenGL.GenVertexArrays怎麽用?C# OpenGL.GenVertexArrays使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SharpGL.OpenGL的用法示例。


在下文中一共展示了OpenGL.GenVertexArrays方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: VAO

        public VAO(OpenGL gl, IShaderProgram program, VBO vbo)
        {
            _gl = gl;
            _program = program;
            VBO = vbo;

            var buffers = new uint[1];
            gl.GenVertexArrays(1, buffers);
            Handle = buffers[0];

            using (new Bind(program))
            using (new Bind(this))
            using (new Bind(vbo))
            {
                var stride = Vect3f.SizeInBytes * 2 + Vect4f.SizeInBytes;

                gl.EnableVertexAttribArray(0);
                gl.VertexAttribPointer(0, 3, OpenGL.GL_FLOAT, true, stride, IntPtr.Zero);
                gl.BindAttribLocation(program.Handle, 0, "vert_position");

                gl.EnableVertexAttribArray(1);
                gl.VertexAttribPointer(1, 3, OpenGL.GL_FLOAT, true, stride, new IntPtr(Vect3f.SizeInBytes));
                gl.BindAttribLocation(program.Handle, 1, "vert_normal");

                gl.EnableVertexAttribArray(2);
                gl.VertexAttribPointer(2, 4, OpenGL.GL_FLOAT, false, stride, new IntPtr(Vect3f.SizeInBytes * 2));
                gl.BindAttribLocation(program.Handle, 2, "vert_colour");
            }
        }
開發者ID:rho24,項目名稱:OpenCAD,代碼行數:29,代碼來源:VAO.cs

示例2: Mesh

        public Mesh(OpenGL gl, MeshType type)
        {
            this.gl = gl;
            this.bufferCount = 0;

            Type = type;

            uint[] arrs = new uint[1];
            gl.GenVertexArrays(1, arrs);
            ID = arrs[0];
        }
開發者ID:jtdubs,項目名稱:VoxelLand,代碼行數:11,代碼來源:Mesh.cs

示例3: CreateVertexArrayObject

        private void CreateVertexArrayObject(OpenGL gl, RenderMode renderMode)
        {
            if (this.positionBuffer == null || this.colorBuffer == null) { return; }

            this.vertexArrayObject = new uint[1];
            gl.GenVertexArrays(1, this.vertexArrayObject);
            gl.BindVertexArray(this.vertexArrayObject[0]);

            // prepare positions
            {
                int location = shaderProgram.GetAttributeLocation(gl, in_Position);
                ATTRIB_INDEX_POSITION = (uint)location;
                gl.BindBuffer(OpenGL.GL_ARRAY_BUFFER, positionBuffer[0]);
                gl.VertexAttribPointer(ATTRIB_INDEX_POSITION, 3, OpenGL.GL_FLOAT, false, 0, IntPtr.Zero);
                gl.EnableVertexAttribArray(ATTRIB_INDEX_POSITION);
            }
            // prepare colors
            {
                int location = shaderProgram.GetAttributeLocation(gl, in_uv);
                ATTRIB_INDEX_UV = (uint)location;
                gl.BindBuffer(OpenGL.GL_ARRAY_BUFFER, colorBuffer[0]);
                gl.VertexAttribPointer(ATTRIB_INDEX_UV, 1, OpenGL.GL_FLOAT, false, 0, IntPtr.Zero);
                gl.EnableVertexAttribArray(ATTRIB_INDEX_UV);
            }

            gl.BindVertexArray(0);
        }
開發者ID:bitzhuwei,項目名稱:CSharpGL,代碼行數:27,代碼來源:HexahedronGrid.cs

示例4: PrepareNMVAO

        public void PrepareNMVAO(OpenGL gl, NormalMaterialProgram program)
        {
            var vertArrIds = new uint[1];
            gl.GenVertexArrays(1, vertArrIds);

            VaoNM = vertArrIds[0];
            gl.BindVertexArray(VaoNM);

            BindNMVBOs(gl, program);

            gl.EnableVertexAttribArray(0);
            gl.BindVertexArray(0);
        }
開發者ID:jochemgeussens,項目名稱:sharpgl,代碼行數:13,代碼來源:NMHTBufferGroup.cs

示例5: PrepareHTVAO

        public void PrepareHTVAO(OpenGL gl, HitTestProgram program)
        {
            var vertArrIds = new uint[1];
            gl.GenVertexArrays(1, vertArrIds);

            VaoHT = vertArrIds[0];
            gl.BindVertexArray(VaoHT);

            BindHTVBOs(gl, program);

            gl.EnableVertexAttribArray(0);
            gl.BindVertexArray(0);
        }
開發者ID:jochemgeussens,項目名稱:sharpgl,代碼行數:13,代碼來源:NMHTBufferGroup.cs

示例6: initGLObjects

        private void initGLObjects(OpenGL gl, out uint vaoHandle, out uint programHandle)
        {
            uint[] vaos = new uint[1];
            gl.GenVertexArrays(1, vaos);
            vaoHandle = vaos[0];

            programHandle = gl.CreateProgram();
        }
開發者ID:dboone,項目名稱:shader-baker,代碼行數:8,代碼來源:GlContextManager.cs

示例7: PrepareVAO

        public void PrepareVAO(OpenGL gl, LinesProgram program)
        {
            var vertArrIds = new uint[1];
            gl.GenVertexArrays(1, vertArrIds);

            Vao = vertArrIds[0];
            gl.BindVertexArray(Vao);

            BindVBOs(gl, program);

            gl.EnableVertexAttribArray(0);
            gl.BindVertexArray(0);
        }
開發者ID:jochemgeussens,項目名稱:sharpgl,代碼行數:13,代碼來源:LinesBufferGroup.cs

示例8: VAO

 public VAO(OpenGL gl)
 {
     _gl = gl;
     _gl.GenVertexArrays(2, _vao);
 }
開發者ID:veggielane,項目名稱:OpenCAD,代碼行數:5,代碼來源:VAO.cs


注:本文中的SharpGL.OpenGL.GenVertexArrays方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。