void OGLESGraphicsBuffer::CopyToBuffer(GraphicsBuffer& rhs) { GraphicsBuffer::Mapper lhs_mapper(*this, BA_Read_Only); GraphicsBuffer::Mapper rhs_mapper(rhs, BA_Write_Only); std::copy(lhs_mapper.Pointer<uint8_t>(), lhs_mapper.Pointer<uint8_t>() + size_in_byte_, rhs_mapper.Pointer<uint8_t>()); }
void OGLGraphicsBuffer::CopyToBuffer(GraphicsBuffer& rhs) { if (glloader_GL_VERSION_3_1() || glloader_GL_ARB_copy_buffer()) { OGLRenderEngine& re = *checked_cast<OGLRenderEngine*>(&Context::Instance().RenderFactoryInstance().RenderEngineInstance()); re.BindBuffer(GL_COPY_READ_BUFFER, vb_); re.BindBuffer(GL_COPY_WRITE_BUFFER, checked_cast<OGLGraphicsBuffer*>(&rhs)->vb_); glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 0, size_in_byte_); } else { GraphicsBuffer::Mapper lhs_mapper(*this, BA_Read_Only); GraphicsBuffer::Mapper rhs_mapper(rhs, BA_Write_Only); std::copy(lhs_mapper.Pointer<uint8_t>(), lhs_mapper.Pointer<uint8_t>() + size_in_byte_, rhs_mapper.Pointer<uint8_t>()); } }