From 701c6c39a9c9597940cd6c2742702709c15a0977 Mon Sep 17 00:00:00 2001 From: HuYingzhuo Date: Wed, 27 Mar 2019 16:26:45 +0800 Subject: [PATCH] =?UTF-8?q?vao=E6=9E=84=E9=80=A0=E6=97=A0=E9=9C=80?= =?UTF-8?q?=E5=86=8D=E4=BC=A0=E5=85=A5=E5=B1=9E=E6=80=A7=E4=B8=AA=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/DirectGLRender/main.cpp | 6 +++--- inc/hgl/graph/VertexArray.h | 2 +- src/RenderDriver/VertexArray.cpp | 7 ++----- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/example/DirectGLRender/main.cpp b/example/DirectGLRender/main.cpp index 54d01fa5..21665a6e 100644 --- a/example/DirectGLRender/main.cpp +++ b/example/DirectGLRender/main.cpp @@ -68,10 +68,10 @@ void InitVertexBuffer() vb_vertex=CreateVBO(VB2f(3,vertex_data)); vb_color=CreateVBO(VB3f(3,color_data)); - va=new VertexArray(2); //两个属性 + va=new VertexArray(); ///<创建VAO - const int vertex_location=shader.GetAttribLocation("Vertex"); ///<取得顶点数据输入流对应的shader地址 - const int color_location=shader.GetAttribLocation("Color"); ///<取得颜色数据输入流对应的shader地址 + const int vertex_location=shader.GetAttribLocation("Vertex"); ///<取得顶点数据输入流对应的shader地址 + const int color_location=shader.GetAttribLocation("Color"); ///<取得颜色数据输入流对应的shader地址 va->SetPosition(vertex_location,vb_vertex); va->AddBuffer(color_location,vb_color); diff --git a/inc/hgl/graph/VertexArray.h b/inc/hgl/graph/VertexArray.h index 17647268..75772c72 100644 --- a/inc/hgl/graph/VertexArray.h +++ b/inc/hgl/graph/VertexArray.h @@ -26,7 +26,7 @@ namespace hgl public: - VertexArray(GLint max_vertex_attrib); + VertexArray(); ~VertexArray(); static int GetMaxVertexAttrib(); diff --git a/src/RenderDriver/VertexArray.cpp b/src/RenderDriver/VertexArray.cpp index 807569e3..c64259e1 100644 --- a/src/RenderDriver/VertexArray.cpp +++ b/src/RenderDriver/VertexArray.cpp @@ -18,12 +18,9 @@ namespace hgl return HGL_MAX_VERTEX_ATTRIBS; } - VertexArray::VertexArray(GLint max_vertex_attrib) + VertexArray::VertexArray() { - if(max_vertex_attrib>GetMaxVertexAttrib()) - max_vertex_attrib=HGL_MAX_VERTEX_ATTRIBS; - - vbo_list.PreMalloc(max_vertex_attrib); + vbo_list.PreMalloc(HGL_MAX_VERTEX_ATTRIBS); element_buffer=nullptr;