Efficient visualization of large number of particles using openGL

I have been looking into using some software to perform industrial-scale DEM simulations. These type of simulations will require millions of particles to be simulated.

Currently, the software I would like to use has some notable performance issues when visualizing the results during the simulation when using openGL. It turns out the part of the code responsible for drawing the particles is this:

void Draw_ParticleGeometry_Sphere() {   SetColor_Ramp();  //if(m_OpenGL.Debug_Lines==1) //{ //  Gl_WireframeP = true; //}    for( int i=0; i<m_num_KParticleObjects; i++ )   {      glNewList(10+i,GL_COMPILE);      if(m_OpenGL.color_type==0)     {      glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, Col[i]);      glMaterialfv(GL_FRONT, GL_SPECULAR, materialSpecular);      glMaterialfv(GL_FRONT, GL_EMISSION, materialEmission);      glMaterialf(GL_FRONT, GL_SHININESS, shininess);     }           glPushMatrix();            glutSolidSphere(m_KParticleObject[i].radius,20,20);            if(Gl_WireframeP)           {                   glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, Col[6]);                  glMaterialfv(GL_FRONT, GL_SPECULAR, materialSpecular);                  glMaterialfv(GL_FRONT, GL_EMISSION, materialEmission);                  glMaterialf(GL_FRONT, GL_SHININESS, shininess);             glutWireSphere(m_KParticleObject[i].radius*1.02f,15,15);           }           glPopMatrix();       glEndList();    }  } 

To be fair im new to openGL, but it seems to me that this piece of code loops over all particles, assigns them attributes and add them to a list. Generally, looping like this is not very efficient for a large number of elements. I have been reading up in visualizing particles in openGL and it seems instancing would be a better fit. My questions are:

  • Is looping over all particles like this is an efficient way of handling such large systems of particles in openGL?
  • How could this code be improved?

Replay

Category: opengl Time: 2016-07-29 Views: 0
Tags: opengl

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.134 (s). 12 q(s)