diff options
| author | Markus Wick <degasus@users.noreply.github.com> | 2015-11-25 07:53:58 +0100 |
|---|---|---|
| committer | Markus Wick <degasus@users.noreply.github.com> | 2015-11-25 07:53:58 +0100 |
| commit | 662e4fcca061e3fe67a5d529fee5cbceee741797 (patch) | |
| tree | 1413d32886af8194afd8a97ecf28715ab1d08666 /Source/Core/VideoBackends/OGL/NativeVertexFormat.cpp | |
| parent | f560e8e283281d6130b2592617f2fe6453cebf83 (diff) | |
| parent | 0b02dc4f814c4e842f460fd0814b8a7c5379b8c8 (diff) | |
Merge pull request #3276 from degasus/videocommon
Videocommon API cleanup
Diffstat (limited to 'Source/Core/VideoBackends/OGL/NativeVertexFormat.cpp')
| -rw-r--r-- | Source/Core/VideoBackends/OGL/NativeVertexFormat.cpp | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/Source/Core/VideoBackends/OGL/NativeVertexFormat.cpp b/Source/Core/VideoBackends/OGL/NativeVertexFormat.cpp index f7f3ab301a..004692999f 100644 --- a/Source/Core/VideoBackends/OGL/NativeVertexFormat.cpp +++ b/Source/Core/VideoBackends/OGL/NativeVertexFormat.cpp @@ -21,19 +21,9 @@ namespace OGL { -NativeVertexFormat* VertexManager::CreateNativeVertexFormat() +NativeVertexFormat* VertexManager::CreateNativeVertexFormat(const PortableVertexDeclaration& vtx_decl) { - return new GLVertexFormat(); -} - -GLVertexFormat::GLVertexFormat() -{ - -} - -GLVertexFormat::~GLVertexFormat() -{ - glDeleteVertexArrays(1, &VAO); + return new GLVertexFormat(vtx_decl); } static inline GLuint VarToGL(VarType t) @@ -56,7 +46,7 @@ static void SetPointer(u32 attrib, u32 stride, const AttributeFormat &format) glVertexAttribPointer(attrib, format.components, VarToGL(format.type), true, stride, (u8*)nullptr + format.offset); } -void GLVertexFormat::Initialize(const PortableVertexDeclaration &_vtx_decl) +GLVertexFormat::GLVertexFormat(const PortableVertexDeclaration& _vtx_decl) { this->vtx_decl = _vtx_decl; u32 vertex_stride = _vtx_decl.stride; @@ -74,22 +64,27 @@ void GLVertexFormat::Initialize(const PortableVertexDeclaration &_vtx_decl) glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vm->m_index_buffers); glBindBuffer(GL_ARRAY_BUFFER, vm->m_vertex_buffers); - SetPointer(SHADER_POSITION_ATTRIB, vertex_stride, vtx_decl.position); + SetPointer(SHADER_POSITION_ATTRIB, vertex_stride, _vtx_decl.position); for (int i = 0; i < 3; i++) - SetPointer(SHADER_NORM0_ATTRIB+i, vertex_stride, vtx_decl.normals[i]); + SetPointer(SHADER_NORM0_ATTRIB+i, vertex_stride, _vtx_decl.normals[i]); for (int i = 0; i < 2; i++) - SetPointer(SHADER_COLOR0_ATTRIB+i, vertex_stride, vtx_decl.colors[i]); + SetPointer(SHADER_COLOR0_ATTRIB+i, vertex_stride, _vtx_decl.colors[i]); for (int i = 0; i < 8; i++) - SetPointer(SHADER_TEXTURE0_ATTRIB+i, vertex_stride, vtx_decl.texcoords[i]); + SetPointer(SHADER_TEXTURE0_ATTRIB+i, vertex_stride, _vtx_decl.texcoords[i]); - SetPointer(SHADER_POSMTX_ATTRIB, vertex_stride, vtx_decl.posmtx); + SetPointer(SHADER_POSMTX_ATTRIB, vertex_stride, _vtx_decl.posmtx); vm->m_last_vao = VAO; } +GLVertexFormat::~GLVertexFormat() +{ + glDeleteVertexArrays(1, &VAO); +} + void GLVertexFormat::SetupVertexPointers() { } |
