diff --git a/Fltk/openglWindow.cpp b/Fltk/openglWindow.cpp index baf3730f8ddc5428087b47ef734aa49c5838448d..2d90a691cba9b8fa16dbb886b9fef879a018b40b 100644 --- a/Fltk/openglWindow.cpp +++ b/Fltk/openglWindow.cpp @@ -153,7 +153,9 @@ void openglWindow::draw() Msg::Debug("openglWindow::draw()"); - if(!context_valid()) _ctx->invalidateQuadricsAndDisplayLists(); + if(!context_valid()){ + _ctx->invalidateQuadricsAndDisplayLists(); + } _ctx->viewport[0] = 0; _ctx->viewport[1] = 0; diff --git a/Geo/GModel.h b/Geo/GModel.h index a9d3c9fb8ba53a88dfcd508f47ab9910b3345b67..6e1de7891f0bea3cbb770bcc1e9e7d762f6ba8c6 100644 --- a/Geo/GModel.h +++ b/Geo/GModel.h @@ -429,7 +429,7 @@ class GModel void createTopologyFromFaces(std::vector<discreteFace*> &pFaces, int ignoreHoles=0); void makeDiscreteRegionsSimplyConnected(); void makeDiscreteFacesSimplyConnected(); - + // align periodic boundaries void alignPeriodicBoundaries(); @@ -489,7 +489,7 @@ class GModel void createPartitionBoundaries(int createGhostCells, int createAllDims = 0); // fill the vertex arrays, given the current option and data - void fillVertexArrays(); + bool fillVertexArrays(); // reclassify a mesh i.e. use an angle threshold to tag edges faces and regions void classifyFaces(std::set<GFace*> &_faces); diff --git a/Geo/GModelVertexArrays.cpp b/Geo/GModelVertexArrays.cpp index 952105a99494ad5fd466087d401e2f7d7cfdac3b..9c4c1763a5d3245f8a57bc99342086580ca5ab04 100644 --- a/Geo/GModelVertexArrays.cpp +++ b/Geo/GModelVertexArrays.cpp @@ -413,9 +413,9 @@ class initMeshGRegion { } }; -void GModel::fillVertexArrays() +bool GModel::fillVertexArrays() { - if(!getVisibility() || !CTX::instance()->mesh.changed) return; + if(!getVisibility() || !CTX::instance()->mesh.changed) return false; Msg::Debug("Mesh has changed: reinitializing vertex arrays"); @@ -434,4 +434,5 @@ void GModel::fillVertexArrays() if(status >= 3 && CTX::instance()->mesh.changed & ENT_VOLUME) std::for_each(firstRegion(), lastRegion(), initMeshGRegion()); + return true; } diff --git a/Graphics/drawContext.cpp b/Graphics/drawContext.cpp index 19386228b30170e5b33081928e6cdb2d61593c37..0827f40e35794c9300ec9196816d52af3236dddb 100644 --- a/Graphics/drawContext.cpp +++ b/Graphics/drawContext.cpp @@ -285,8 +285,6 @@ void drawContext::draw3d() CTX::instance()->mesh.volumesNum) numStrings = std::max(numStrings, GModel::current()->getNumMeshElements()); numStrings *= 2; - // FIXME: restting to 1 each time to workaround bug on recent MacOS versions - gl_texture_pile_height(1); if(gl_texture_pile_height() < numStrings) gl_texture_pile_height(numStrings); #endif diff --git a/Graphics/drawMesh.cpp b/Graphics/drawMesh.cpp index 7544c357bd523ae7458ea9e64fb704847d1d292c..76a9ea56e39619a00e5118579c234d4cd19fa3e8 100644 --- a/Graphics/drawMesh.cpp +++ b/Graphics/drawMesh.cpp @@ -27,6 +27,11 @@ #include "PView.h" #include "PViewData.h" +#if defined(HAVE_FLTK) +#include <FL/Fl.H> +#include <FL/gl.h> +#endif + // from GModelVertexArrays extern unsigned int getColorByEntity(GEntity *e); extern bool isElementVisible(MElement *ele); @@ -685,7 +690,11 @@ void drawContext::drawMesh() for(unsigned int i = 0; i < GModel::list.size(); i++){ GModel *m = GModel::list[i]; - m->fillVertexArrays(); + bool changed = m->fillVertexArrays(); +#if defined(HAVE_FLTK) && defined(__APPLE__) + // FIXME: resetting texture pile fixes bug with recent MacOS versions + if(changed) gl_texture_pile_height(gl_texture_pile_height()); +#endif if(m->getVisibility() && isVisible(m)){ int status = m->getMeshStatus(); if(status >= 0) diff --git a/Graphics/drawPost.cpp b/Graphics/drawPost.cpp index cdcea4a6a69dd59ae3930bef839020878ed14f65..b35bffe0845e7dd54ce246de0b3feef60f63d2d4 100644 --- a/Graphics/drawPost.cpp +++ b/Graphics/drawPost.cpp @@ -577,7 +577,13 @@ void drawContext::drawPost() if(!CTX::instance()->post.draw) return; - for(unsigned int i = 0; i < PView::list.size(); i++) - PView::list[i]->fillVertexArrays(); - std::for_each(PView::list.begin(), PView::list.end(), drawPView(this)); + for(unsigned int i = 0; i < PView::list.size(); i++){ + bool changed = PView::list[i]->fillVertexArrays(); +#if defined(HAVE_FLTK) && defined(__APPLE__) + // FIXME: resetting texture pile fixes bug with recent MacOS versions + if(changed) gl_texture_pile_height(gl_texture_pile_height()); +#endif + } + + std::for_each(PView::list.begin(), PView::list.end(), drawPView(this)); } diff --git a/Post/PView.h b/Post/PView.h index 478f77c4e60f368dd301a68f5b684b20abdc86a9..78922d7ef6c2a8993369e826f3d5691840c08665 100644 --- a/Post/PView.h +++ b/Post/PView.h @@ -135,7 +135,7 @@ class PView{ VertexArray *va_points, *va_lines, *va_triangles, *va_vectors, *va_ellipses; // fill the vertex arrays, given the current option and data - void fillVertexArrays(); + bool fillVertexArrays(); // fill a vertex array using a raw stream of bytes static void fillVertexArray(onelab::localNetworkClient *remote, int length, diff --git a/Post/PViewVertexArrays.cpp b/Post/PViewVertexArrays.cpp index 013694845c93f405eaa49a894bdb01d978b19697..157e4b86d5beb56db17aeda0cabe2919d9ca1973 100644 --- a/Post/PViewVertexArrays.cpp +++ b/Post/PViewVertexArrays.cpp @@ -1388,14 +1388,16 @@ class initPView { return heuristic + 1000; } public: - void operator () (PView *p) + bool operator () (PView *p) { // use adaptive data if available PViewData *data = p->getData(true); PViewOptions *opt = p->getOptions(); - if(data->getDirty() || !data->getNumTimeSteps() || !p->getChanged()) return; - if(!opt->visible || opt->type != PViewOptions::Plot3D) return; + if(data->getDirty() || !data->getNumTimeSteps() || !p->getChanged()) + return false; + if(!opt->visible || opt->type != PViewOptions::Plot3D) + return false; p->deleteVertexArrays(); @@ -1405,7 +1407,7 @@ class initPView { PrintOptions(0, GMSH_FULLRC, 0, 0, fileName.c_str()); std::string options = ConvertFileToString(fileName); data->fillRemoteVertexArrays(options); - return; + return false; } if(opt->useGenRaise) opt->createGeneralRaise(); @@ -1432,6 +1434,7 @@ class initPView { p->va_ellipses = new VertexArray(4, _estimateNumEllipses(p)); if(p->normals) delete p->normals; + p->normals = new smooth_normals(opt->angleSmoothNormals); if(opt->smoothNormals) addElementsInArrays(p, true); @@ -1451,13 +1454,14 @@ class initPView { p->va_vectors->getMemoryInMb() + p->va_ellipses->getMemoryInMb()); p->setChanged(false); + return true; } }; -void PView::fillVertexArrays() +bool PView::fillVertexArrays() { initPView init; - init(this); + return init(this); } void PView::fillVertexArray(onelab::localNetworkClient *remote, int length,