Unsolved QOpenGLWidget doesn't draw some of my objects
-
I have some 1300 objects that draw themselves in a loop like this:
void svGLWidget::paintGL() { auto f = GLFunctions(); m_drawingFacilities.glFunctions = f; m_drawingFacilities.projection = m_projection; m_drawingFacilities.modelview = m_modelview; m_drawingFacilities.viewDir = ViewDirection(); m_drawingFacilities.upDir = UpDirection(); f->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); auto objs = EnabledObjectsIntersectingViewVolume(); for (auto it : objs) it->first->Draw( m_drawingFacilities, *it->second.m_vs_sptr.get(), svHObject::DrawMode::COLORS ); if (m_state == &m_state_drawSelectonFrame) m_state_drawSelectonFrame.DrawFrame(); }
The project is complicated enough that I cannot place here all code involved.
When I upload too many objects on the scene, some of them are not visible. In debug I can see that their Draw() function is invoked, but they don't show up on the screen anyway. It is not a clipping planes issue. When I delete e.g. ~1200 objects, reducing number of objects on the screen, then objects appear on the view that didn't draw themselves earlier. And they stay on the screen if I load the deleted objects back, though I don't know if any of newly loaded objects don't draw themselves — there's no easy way to tell that.So how do I fix it?
-
Hi and welcome to devnet,
Do you have any depth test enabled ?
-
Yes, but I don't see how that can be a problem. There may be 2 objects beside (even intersecting) each other and only one of them is visible.
-
It was just a guess as you didn't explain how you were painting your objects nor if they are on top of each other.