diff --git a/gale/resource/Manager.cpp b/gale/resource/Manager.cpp index 5ce843f..759fa1f 100644 --- a/gale/resource/Manager.cpp +++ b/gale/resource/Manager.cpp @@ -21,7 +21,7 @@ gale::resource::Manager::Manager() : } gale::resource::Manager::~Manager() { - std11::unique_lock lock(m_mutex); + std11::unique_lock lock(m_mutex); bool hasError = false; if (m_resourceListToUpdate.size()!=0) { GALE_ERROR("Must not have anymore resources to update !!!"); @@ -38,7 +38,7 @@ gale::resource::Manager::~Manager() { } void gale::resource::Manager::unInit() { - std11::unique_lock lock(m_mutex); + std11::unique_lock lock(m_mutex); display(); m_resourceListToUpdate.clear(); // remove all resources ... @@ -59,7 +59,7 @@ void gale::resource::Manager::unInit() { void gale::resource::Manager::display() { GALE_INFO("Resources loaded : "); // remove all resources ... - std11::unique_lock lock(m_mutex); + std11::unique_lock lock(m_mutex); for (auto &it : m_resourceList) { std::shared_ptr tmpRessource = it.lock(); if (tmpRessource != nullptr) { @@ -75,7 +75,7 @@ void gale::resource::Manager::display() { void gale::resource::Manager::reLoadResources() { GALE_INFO("------------- Resources re-loaded -------------"); // remove all resources ... - std11::unique_lock lock(m_mutex); + std11::unique_lock lock(m_mutex); if (m_resourceList.size() != 0) { for (size_t jjj=0; jjj& _object) { // chek if not added before - std11::unique_lock lock(m_mutex); + std11::unique_lock lock(m_mutex); for (auto &it : m_resourceListToUpdate) { if ( it != nullptr && it == _object) { @@ -111,44 +111,63 @@ void gale::resource::Manager::update(const std::shared_ptr& _obj // Specific to load or update the data in the openGl context == > system use only void gale::resource::Manager::updateContext() { - std11::unique_lock lock(m_mutex); // TODO : Check the number of call this ... GALE_INFO("update open-gl context ... "); if (m_contextHasBeenRemoved == true) { // need to update all ... m_contextHasBeenRemoved = false; - if (m_resourceList.size() != 0) { + std::list> resourceList; + { + std11::unique_lock lock(m_mutex); + // Clean the update list + m_resourceListToUpdate.clear(); + resourceList = m_resourceList; + } + if (resourceList.size() != 0) { for (size_t jjj=0; jjj tmpRessource = it.lock(); if( tmpRessource != nullptr && jjj == tmpRessource->getResourceLevel()) { //GALE_DEBUG("Update context named : " << l_resourceList[iii]->getName()); - tmpRessource->updateContext(); + if (tmpRessource->updateContext() == false) { + // Lock error ==> postponned + std11::unique_lock lock(m_mutex); + m_resourceListToUpdate.push_back(tmpRessource); + } } } } } } else { - if (m_resourceListToUpdate.size() != 0) { + std::vector> resourceListToUpdate; + { + std11::unique_lock lock(m_mutex); + resourceListToUpdate = m_resourceListToUpdate; + // Clean the update list + m_resourceListToUpdate.clear(); + } + if (resourceListToUpdate.size() != 0) { for (size_t jjj=0; jjjgetResourceLevel()) { - it->updateContext(); + if (it->updateContext() == false) { + std11::unique_lock lock(m_mutex); + // Lock error ==> postponned + m_resourceListToUpdate.push_back(it); + } } } } } } - // Clean the update list - m_resourceListToUpdate.clear(); } // in this case, it is really too late ... void gale::resource::Manager::contextHasBeenDestroyed() { - std11::unique_lock lock(m_mutex); + std11::unique_lock lock(m_mutex); for (auto &it : m_resourceList) { std::shared_ptr tmpRessource = it.lock(); if (tmpRessource != nullptr) { @@ -161,7 +180,7 @@ void gale::resource::Manager::contextHasBeenDestroyed() { // internal generic keeper ... std::shared_ptr gale::resource::Manager::localKeep(const std::string& _filename) { - std11::unique_lock lock(m_mutex); + std11::unique_lock lock(m_mutex); GALE_VERBOSE("KEEP (DEFAULT) : file : '" << _filename << "' in " << m_resourceList.size() << " resources"); for (auto &it : m_resourceList) { std::shared_ptr tmpRessource = it.lock(); @@ -176,7 +195,7 @@ std::shared_ptr gale::resource::Manager::localKeep(const std::st // internal generic keeper ... void gale::resource::Manager::localAdd(const std::shared_ptr& _object) { - std11::unique_lock lock(m_mutex); + std11::unique_lock lock(m_mutex); //Add ... find empty slot for (auto &it : m_resourceList) { std::shared_ptr tmpRessource = it.lock(); @@ -191,7 +210,7 @@ void gale::resource::Manager::localAdd(const std::shared_ptr& _o // in case of error ... void gale::resource::Manager::cleanInternalRemoved() { - std11::unique_lock lock(m_mutex); + std11::unique_lock lock(m_mutex); //GALE_INFO("remove object in Manager"); updateContext(); for (auto it(m_resourceList.begin()); it!=m_resourceList.end(); ++it) { diff --git a/gale/resource/Manager.h b/gale/resource/Manager.h index c011928..ee515e6 100644 --- a/gale/resource/Manager.h +++ b/gale/resource/Manager.h @@ -22,7 +22,7 @@ namespace gale { std::list> m_resourceList; std::vector> m_resourceListToUpdate; bool m_contextHasBeenRemoved; - std11::mutex m_mutex; + std11::recursive_mutex m_mutex; public: /** * @brief initialize the internal variable diff --git a/gale/resource/Program.cpp b/gale/resource/Program.cpp index a14952a..b11b194 100644 --- a/gale/resource/Program.cpp +++ b/gale/resource/Program.cpp @@ -141,13 +141,19 @@ void gale::resource::Program::checkGlError(const char* _op, int32_t _localLine, if (isPresent == true) { GALE_ERROR(" in program name : " << m_name); GALE_ERROR(" program OpenGL ID =" << m_program); - GALE_ERROR(" List IO :"); + GALE_ERROR(" List Uniform:"); int32_t id = 0; for (auto &it : m_elementList) { - if (id == _idElem) { - GALE_ERROR(" * name :" << it.m_name << " OpenGL ID=" << it.m_elementId << " attribute=" << it.m_isAttribute << " is linked=" << it.m_isLinked); - } else { - GALE_ERROR(" name :" << it.m_name << " OpenGL ID=" << it.m_elementId << " attribute=" << it.m_isAttribute << " is linked=" << it.m_isLinked); + if (it.m_isAttribute == false) { + GALE_ERROR(" " << (id==_idElem?"*":" ") << " name :" << it.m_name << " OpenGL ID=" << it.m_elementId << " is linked=" << it.m_isLinked); + } + id++; + } + GALE_ERROR(" List Attribute:"); + id = 0; + for (auto &it : m_elementList) { + if (it.m_isAttribute == true) { + GALE_ERROR(" " << (id==_idElem?"*":" ") << " name :" << it.m_name << " OpenGL ID=" << it.m_elementId << " is linked=" << it.m_isLinked); } id++; } @@ -180,18 +186,22 @@ int32_t gale::resource::Program::getAttribute(std::string _elementName) { progAttributeElement tmp; tmp.m_name = _elementName; tmp.m_isAttribute = true; - if (m_exist == true) { + if (gale::openGL::hasContext() == false) { + getManager().update(std::dynamic_pointer_cast(shared_from_this())); + tmp.m_elementId = -1; + tmp.m_isLinked = false; + } else if (m_exist == true) { tmp.m_elementId = gale::openGL::program::getAttributeLocation(m_program, tmp.m_name); tmp.m_isLinked = true; if (tmp.m_elementId<0) { - GALE_WARNING(" [" << m_elementList.size() << "] glGetAttribLocation(\"" << tmp.m_name << "\") = " << tmp.m_elementId); + GALE_WARNING(" {" << m_program << "}[" << m_elementList.size() << "] glGetAttribLocation(\"" << tmp.m_name << "\") = " << tmp.m_elementId); tmp.m_isLinked = false; } else { - GALE_INFO(" [" << m_elementList.size() << "] glGetAttribLocation(\"" << tmp.m_name << "\") = " << tmp.m_elementId); + GALE_INFO(" {" << m_program << "}[" << m_elementList.size() << "] glGetAttribLocation(\"" << tmp.m_name << "\") = " << tmp.m_elementId); } } else { // program is not loaded ==> just local reister ... - tmp.m_elementId = gale::openGL::program::getUniformLocation(m_program, tmp.m_name); + tmp.m_elementId = -1; tmp.m_isLinked = false; } m_elementList.push_back(tmp); @@ -209,26 +219,34 @@ int32_t gale::resource::Program::getUniform(std::string _elementName) { progAttributeElement tmp; tmp.m_name = _elementName; tmp.m_isAttribute = false; - if (m_exist == true) { + if (gale::openGL::hasContext() == false) { + getManager().update(std::dynamic_pointer_cast(shared_from_this())); + tmp.m_elementId = -1; + tmp.m_isLinked = false; + } else if (m_exist == true) { tmp.m_elementId = gale::openGL::program::getUniformLocation(m_program, tmp.m_name); tmp.m_isLinked = true; if (tmp.m_elementId<0) { - GALE_WARNING(" [" << m_elementList.size() << "] glGetUniformLocation(\"" << tmp.m_name << "\") = " << tmp.m_elementId); + GALE_WARNING(" {" << m_program << "}[" << m_elementList.size() << "] glGetUniformLocation(\"" << tmp.m_name << "\") = " << tmp.m_elementId); tmp.m_isLinked = false; } else { - GALE_INFO(" [" << m_elementList.size() << "] glGetUniformLocation(\"" << tmp.m_name << "\") = " << tmp.m_elementId); + GALE_INFO(" {" << m_program << "}[" << m_elementList.size() << "] glGetUniformLocation(\"" << tmp.m_name << "\") = " << tmp.m_elementId); } } else { // program is not loaded ==> just local reister ... - tmp.m_elementId = gale::openGL::program::getUniformLocation(m_program, tmp.m_name); + tmp.m_elementId = -1; tmp.m_isLinked = false; } m_elementList.push_back(tmp); return m_elementList.size()-1; } -void gale::resource::Program::updateContext() { - std11::unique_lock lock(m_mutex); +bool gale::resource::Program::updateContext() { + std11::unique_lock lock(m_mutex, std11::defer_lock); + if (lock.try_lock() == false) { + //Lock error ==> try later ... + return false; + } if (m_exist == true) { // Do nothing == > too dangerous ... } else { @@ -236,7 +254,7 @@ void gale::resource::Program::updateContext() { GALE_INFO("Create the Program ... \"" << m_name << "\""); m_program = gale::openGL::program::create(); if (m_program < 0) { - return; + return true; } // first attach vertex shader, and after fragment shader for (size_t iii=0; iii lock(m_mutex); + if (m_exist == false) { return; } if (_idElem<0 || (size_t)_idElem>m_elementList.size()) { @@ -468,7 +493,8 @@ void gale::resource::Program::uniform2f(int32_t _idElem, float _value1, float _ checkGlError("glUniform2f", __LINE__, _idElem); } void gale::resource::Program::uniform3f(int32_t _idElem, float _value1, float _value2, float _value3) { - if (0 == m_program) { + std11::unique_lock lock(m_mutex); + if (m_exist == false) { return; } if (_idElem<0 || (size_t)_idElem>m_elementList.size()) { @@ -482,7 +508,8 @@ void gale::resource::Program::uniform3f(int32_t _idElem, float _value1, float _v checkGlError("glUniform3f", __LINE__, _idElem); } void gale::resource::Program::uniform4f(int32_t _idElem, float _value1, float _value2, float _value3, float _value4) { - if (0 == m_program) { + std11::unique_lock lock(m_mutex); + if (m_exist == false) { return; } if (_idElem<0 || (size_t)_idElem>m_elementList.size()) { @@ -499,7 +526,8 @@ void gale::resource::Program::uniform4f(int32_t _idElem, float _value1, float _v ////////////////////////////////////////////////////////////////////////////////////////////// void gale::resource::Program::uniform1i(int32_t _idElem, int32_t _value1) { - if (0 == m_program) { + std11::unique_lock lock(m_mutex); + if (m_exist == false) { return; } if (_idElem<0 || (size_t)_idElem>m_elementList.size()) { @@ -513,7 +541,8 @@ void gale::resource::Program::uniform1i(int32_t _idElem, int32_t _value1) { checkGlError("glUniform1i", __LINE__, _idElem); } void gale::resource::Program::uniform2i(int32_t _idElem, int32_t _value1, int32_t _value2) { - if (0 == m_program) { + std11::unique_lock lock(m_mutex); + if (m_exist == false) { return; } if (_idElem<0 || (size_t)_idElem>m_elementList.size()) { @@ -527,7 +556,8 @@ void gale::resource::Program::uniform2i(int32_t _idElem, int32_t _value1, int32_ checkGlError("glUniform2i", __LINE__, _idElem); } void gale::resource::Program::uniform3i(int32_t _idElem, int32_t _value1, int32_t _value2, int32_t _value3) { - if (0 == m_program) { + std11::unique_lock lock(m_mutex); + if (m_exist == false) { return; } if (_idElem<0 || (size_t)_idElem>m_elementList.size()) { @@ -541,7 +571,8 @@ void gale::resource::Program::uniform3i(int32_t _idElem, int32_t _value1, int32_ checkGlError("glUniform3i", __LINE__, _idElem); } void gale::resource::Program::uniform4i(int32_t _idElem, int32_t _value1, int32_t _value2, int32_t _value3, int32_t _value4) { - if (0 == m_program) { + std11::unique_lock lock(m_mutex); + if (m_exist == false) { return; } if (_idElem<0 || (size_t)_idElem>m_elementList.size()) { @@ -559,7 +590,8 @@ void gale::resource::Program::uniform4i(int32_t _idElem, int32_t _value1, int32_ ////////////////////////////////////////////////////////////////////////////////////////////// void gale::resource::Program::uniform1fv(int32_t _idElem, int32_t _nbElement, const float *_value) { - if (0 == m_program) { + std11::unique_lock lock(m_mutex); + if (m_exist == false) { return; } if (_idElem<0 || (size_t)_idElem>m_elementList.size()) { @@ -581,7 +613,8 @@ void gale::resource::Program::uniform1fv(int32_t _idElem, int32_t _nbElement, co checkGlError("glUniform1fv", __LINE__, _idElem); } void gale::resource::Program::uniform2fv(int32_t _idElem, int32_t _nbElement, const float *_value) { - if (0 == m_program) { + std11::unique_lock lock(m_mutex); + if (m_exist == false) { return; } if (_idElem<0 || (size_t)_idElem>m_elementList.size()) { @@ -603,7 +636,8 @@ void gale::resource::Program::uniform2fv(int32_t _idElem, int32_t _nbElement, co checkGlError("glUniform2fv", __LINE__, _idElem); } void gale::resource::Program::uniform3fv(int32_t _idElem, int32_t _nbElement, const float *_value) { - if (0 == m_program) { + std11::unique_lock lock(m_mutex); + if (m_exist == false) { return; } if (_idElem<0 || (size_t)_idElem>m_elementList.size()) { @@ -626,7 +660,8 @@ void gale::resource::Program::uniform3fv(int32_t _idElem, int32_t _nbElement, co checkGlError("glUniform3fv", __LINE__, _idElem); } void gale::resource::Program::uniform4fv(int32_t _idElem, int32_t _nbElement, const float *_value) { - if (0 == m_program) { + std11::unique_lock lock(m_mutex); + if (m_exist == false) { return; } if (_idElem<0 || (size_t)_idElem>m_elementList.size()) { @@ -652,7 +687,8 @@ void gale::resource::Program::uniform4fv(int32_t _idElem, int32_t _nbElement, co ////////////////////////////////////////////////////////////////////////////////////////////// void gale::resource::Program::uniform1iv(int32_t _idElem, int32_t _nbElement, const int32_t *_value) { - if (0 == m_program) { + std11::unique_lock lock(m_mutex); + if (m_exist == false) { return; } if (_idElem<0 || (size_t)_idElem>m_elementList.size()) { @@ -674,7 +710,8 @@ void gale::resource::Program::uniform1iv(int32_t _idElem, int32_t _nbElement, co checkGlError("glUniform1iv", __LINE__, _idElem); } void gale::resource::Program::uniform2iv(int32_t _idElem, int32_t _nbElement, const int32_t *_value) { - if (0 == m_program) { + std11::unique_lock lock(m_mutex); + if (m_exist == false) { return; } if (_idElem<0 || (size_t)_idElem>m_elementList.size()) { @@ -696,7 +733,8 @@ void gale::resource::Program::uniform2iv(int32_t _idElem, int32_t _nbElement, co checkGlError("glUniform2iv", __LINE__, _idElem); } void gale::resource::Program::uniform3iv(int32_t _idElem, int32_t _nbElement, const int32_t *_value) { - if (0 == m_program) { + std11::unique_lock lock(m_mutex); + if (m_exist == false) { return; } if (_idElem<0 || (size_t)_idElem>m_elementList.size()) { @@ -718,7 +756,8 @@ void gale::resource::Program::uniform3iv(int32_t _idElem, int32_t _nbElement, co checkGlError("glUniform3iv", __LINE__, _idElem); } void gale::resource::Program::uniform4iv(int32_t _idElem, int32_t _nbElement, const int32_t *_value) { - if (0 == m_program) { + std11::unique_lock lock(m_mutex); + if (m_exist == false) { return; } if (_idElem<0 || (size_t)_idElem>m_elementList.size()) { @@ -759,7 +798,8 @@ void gale::resource::Program::use() { void gale::resource::Program::setTexture0(int32_t _idElem, int64_t _textureOpenGlID) { - if (0 == m_program) { + std11::unique_lock lock(m_mutex); + if (m_exist == false) { return; } if (_idElem<0 || (size_t)_idElem>m_elementList.size()) { @@ -784,7 +824,8 @@ void gale::resource::Program::setTexture0(int32_t _idElem, int64_t _textureOpenG } void gale::resource::Program::setTexture1(int32_t _idElem, int64_t _textureOpenGlID) { - if (0 == m_program) { + std11::unique_lock lock(m_mutex); + if (m_exist == false) { return; } if (_idElem<0 || (size_t)_idElem>m_elementList.size()) { @@ -811,7 +852,8 @@ void gale::resource::Program::setTexture1(int32_t _idElem, int64_t _textureOpenG void gale::resource::Program::unUse() { //GALE_WARNING("Will use program : " << m_program); - if (0 == m_program) { + std11::unique_lock lock(m_mutex); + if (m_exist == false) { return; } #if 0 diff --git a/gale/resource/Program.h b/gale/resource/Program.h index 61a9332..cfa8b5f 100644 --- a/gale/resource/Program.h +++ b/gale/resource/Program.h @@ -289,7 +289,7 @@ namespace gale { /** * @brief This load/reload the data in the opengl context, needed when removed previously. */ - void updateContext(); + bool updateContext(); /** * @brief remove the data from the opengl context. */ diff --git a/gale/resource/Resource.cpp b/gale/resource/Resource.cpp index 7f4e035..ab925eb 100644 --- a/gale/resource/Resource.cpp +++ b/gale/resource/Resource.cpp @@ -68,8 +68,9 @@ bool gale::Resource::isTypeCompatible(const std::string& _type) { } -void gale::Resource::updateContext() { +bool gale::Resource::updateContext() { GALE_DEBUG("Not set for : [" << getId() << "]" << getName() << " loaded " << shared_from_this().use_count() << " time(s)"); + return true; } void gale::Resource::removeContext() { diff --git a/gale/resource/Resource.h b/gale/resource/Resource.h index 48d7b99..ebc8c4a 100644 --- a/gale/resource/Resource.h +++ b/gale/resource/Resource.h @@ -189,8 +189,10 @@ namespace gale { /** * @brief Call when need to send data on the harware (openGL) * @note This is done asynchronously with the create of the Resource. + * @return true The context is updated + * @return false The context is not updated */ - virtual void updateContext(); + virtual bool updateContext(); /** * @brief The current OpenGl context is removing ==> remove yout own system data */ diff --git a/gale/resource/Shader.cpp b/gale/resource/Shader.cpp index 308c63c..bb13754 100644 --- a/gale/resource/Shader.cpp +++ b/gale/resource/Shader.cpp @@ -51,21 +51,25 @@ gale::resource::Shader::~Shader() { m_exist = false; } -void gale::resource::Shader::updateContext() { - std11::unique_lock lock(m_mutex); +bool gale::resource::Shader::updateContext() { + std11::unique_lock lock(m_mutex, std11::defer_lock); + if (lock.try_lock() == false) { + //Lock error ==> try later ... + return false; + } if (m_exist == true) { // Do nothing == > too dangerous ... } else { // create the Shader if (m_fileData.size() == 0) { m_shader = -1; - return; + return true; } GALE_INFO("Create Shader : '" << m_name << "'"); m_shader = gale::openGL::shader::create(m_type); if (m_shader < 0) { GALE_CRITICAL(" can not load shader"); - return; + return true; } else { GALE_INFO("Compile shader with GLID=" << m_shader); bool ret = gale::openGL::shader::compile(m_shader, m_fileData); @@ -75,11 +79,12 @@ void gale::resource::Shader::updateContext() { tmpShaderType = "VERTEX SHADER"; } GALE_CRITICAL("Could not compile \"" << tmpShaderType << "\" name='" << m_name << "'"); - return; + return true; } } m_exist = true; } + return true; } void gale::resource::Shader::removeContext() { diff --git a/gale/resource/Shader.h b/gale/resource/Shader.h index c9b2351..dfeb91e 100644 --- a/gale/resource/Shader.h +++ b/gale/resource/Shader.h @@ -56,7 +56,7 @@ namespace gale { /** * @brief This load/reload the data in the opengl context, needed when removed previously. */ - void updateContext(); + bool updateContext(); /** * @brief remove the data from the opengl context. */ diff --git a/gale/resource/Texture.cpp b/gale/resource/Texture.cpp index 2986694..8d9f7f5 100644 --- a/gale/resource/Texture.cpp +++ b/gale/resource/Texture.cpp @@ -56,8 +56,12 @@ gale::resource::Texture::~Texture() { removeContext(); } -void gale::resource::Texture::updateContext() { - std11::unique_lock lock(m_mutex); +bool gale::resource::Texture::updateContext() { + std11::unique_lock lock(m_mutex, std11::defer_lock); + if (lock.try_lock() == false) { + //Lock error ==> try later ... + return false; + } if (false == m_loaded) { // Request a new texture at openGl : glGenTextures(1, &m_texId); @@ -86,6 +90,7 @@ void gale::resource::Texture::updateContext() { &((*m_data)[0]) ); // now the data is loaded m_loaded = true; + return true; } void gale::resource::Texture::removeContext() { diff --git a/gale/resource/Texture.h b/gale/resource/Texture.h index 2a3ceed..bc220e4 100644 --- a/gale/resource/Texture.h +++ b/gale/resource/Texture.h @@ -33,7 +33,7 @@ namespace gale { bool m_loaded; //!< internal state of the openGl system. // Gale internal API: public: - virtual void updateContext(); + virtual bool updateContext(); virtual void removeContext(); virtual void removeContextToLate(); // middleware interface: diff --git a/gale/resource/VirtualBufferObject.cpp b/gale/resource/VirtualBufferObject.cpp index 0132581..65b2449 100644 --- a/gale/resource/VirtualBufferObject.cpp +++ b/gale/resource/VirtualBufferObject.cpp @@ -38,8 +38,12 @@ void gale::resource::VirtualBufferObject::retreiveData() { GALE_ERROR("TODO ... "); } -void gale::resource::VirtualBufferObject::updateContext() { - std11::unique_lock lock(m_mutex); +bool gale::resource::VirtualBufferObject::updateContext() { + std11::unique_lock lock(m_mutex, std11::defer_lock); + if (lock.try_lock() == false) { + //Lock error ==> try later ... + return false; + } if (false == m_exist) { // Allocate and assign a Vertex Array Object to our handle gale::openGL::genBuffers(m_vbo); @@ -57,6 +61,7 @@ void gale::resource::VirtualBufferObject::updateContext() { } // un-bind it to permet to have no erreor in the next display ... gale::openGL::unbindBuffer(); + return true; } void gale::resource::VirtualBufferObject::removeContext() { diff --git a/gale/resource/VirtualBufferObject.h b/gale/resource/VirtualBufferObject.h index 40a9074..aa187f5 100644 --- a/gale/resource/VirtualBufferObject.h +++ b/gale/resource/VirtualBufferObject.h @@ -107,7 +107,7 @@ namespace gale { /** * @brief This load/reload the data in the opengl context, needed when removed previously. */ - void updateContext(); + bool updateContext(); /** * @brief remove the data from the opengl context. */