PDA

View Full Version : Maximum size for diplay lists



derbachii
12-05-2008, 08:46 AM
Hi,

I'm trying to diplay a really big triangular mesh 4000000+ triangles using OpenGL (windows) with display lists.

creating the display list as follows:

GLuint createLT(CDT* cdt,GLint num)
{
GLuint dl1 = glGenLists(num);
int error = glGetError();
if (error != GL_NO_ERROR) {
std::cout << "An OpenGL error has occured: " << gluErrorString(error) << std::endl;
}
cout<<"Creating DisplayLists "<<"...";
CDT_Finite_faces_iterator fit = cdt->finite_faces_begin();
int counter = 0;
glNewList(num,GL_COMPILE);
glBegin(GL_TRIANGLES);
for ( ;fit!=cdt->finite_faces_end();++fit)
{
if (fit->is_in_domain())
{
glColor3f(1.0f,1.0f,1.0f);
glVertex3f(fit->vertex(0)->point().x(),fit->vertex(0)->point().y(),0.0f);
glVertex3f(fit->vertex(1)->point().x(),fit->vertex(1)->point().y(),0.0f);
glVertex3f(fit->vertex(2)->point().x(),fit->vertex(2)->point().y(),0.0f);
}
}
glEnd();
glEndList();
cout<<"done"<<endl;
return dl1;
}
After calling this function, glGetError() returns "out of memory". Why?
4Million triangles each with 3x3 float values -> 137 Megabytes (if i'm calculating correctly).

My System: nvidia 8800 GTS (512 Mb), Q6600, 4Gb ram, windows xp (32bit)

Now my question:
Is there a certain size-limit for display lists?
or is this the wrong way to display this amount of data?

thanks in advance.
Daniel.

trinitrotoluene
12-05-2008, 10:41 AM
4Million triangles each with 3x3 float values -> 137 Megabytes (if i'm calculating correctly).

You don't count the color, but since it is always the same maybe the driver optimize it. Also, maybe the driver convert the 3 components vertex to 4 components to fit better in cache line. Another possible explanation is that there is some memory fragmentation on the graphic device so there is no contiguous memory large enough to hold your entire vertex data in one bundle.

derbachii
12-06-2008, 10:18 AM
Hi trinitrotoluene,

thanks for the hint.
Splitting the mesh into smaller (1 million triangle)-lists made it :-)