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;