]> git.tdb.fi Git - libs/gl.git/blobdiff - source/backends/opengl/vertexsetup_backend.cpp
Adjust access to main class members from backend classes
[libs/gl.git] / source / backends / opengl / vertexsetup_backend.cpp
index f3243107b9591186b649a298fe9f7234c7b46355..6dc97411113a21bd0d3d9aae9ca0292415c7d243 100644 (file)
@@ -51,15 +51,17 @@ void OpenGLVertexSetup::update(unsigned mask) const
 {
        static bool direct = ARB_direct_state_access && ARB_vertex_attrib_binding;
 
+       const VertexSetup &self = *static_cast<const VertexSetup *>(this);
+
        if(mask&VertexSetup::VERTEX_ARRAY)
-               update_vertex_array(*static_cast<const VertexSetup *>(this)->vertex_array, 0, 0, direct);
+               update_vertex_array(*self.vertex_array, 0, 0, direct);
 
        if(mask&VertexSetup::INSTANCE_ARRAY)
-               update_vertex_array(*static_cast<const VertexSetup *>(this)->inst_array, 1, 1, direct);
+               update_vertex_array(*self.inst_array, 1, 1, direct);
 
        if(mask&VertexSetup::INDEX_BUFFER)
        {
-               unsigned buf_id = static_cast<const VertexSetup *>(this)->index_buffer->id;
+               unsigned buf_id = self.index_buffer->id;
                if(direct)
                        glVertexArrayElementBuffer(id, buf_id);
                else
@@ -129,17 +131,19 @@ void OpenGLVertexSetup::unload()
        }
        else
        {
+               const VertexSetup &self = *static_cast<const VertexSetup *>(this);
+
                glBindVertexArray(id);
                glBindBuffer(GL_ARRAY_BUFFER, 0);
 
-               for(VertexAttribute a: static_cast<const VertexSetup *>(this)->vertex_format)
+               for(VertexAttribute a: self.vertex_format)
                        if(!is_padding(a))
                        {
                                unsigned sem = get_attribute_semantic(a);
                                glDisableVertexAttribArray(sem);
                                glVertexAttribPointer(sem, 1, GL_FLOAT, false, 0, 0);
                        }
-               for(VertexAttribute a: static_cast<const VertexSetup *>(this)->inst_format)
+               for(VertexAttribute a: self.inst_format)
                        if(!is_padding(a))
                        {
                                unsigned sem = get_attribute_semantic(a);