Dealing with large amount of data

Started by
11 comments, last by 3DViewer 15 years, 11 months ago
Quote:Original post by ma_hty
Display list is usually as good as static VBO (at least on a NVidia display card).
I am going to go out on a limb here and say that this is incorrect. For small amounts of data, you may be right - but in the OP's case, he is most likely bandwidth-limited, and saving the transfer of vertex data every frame should help a lot.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Advertisement
Quote:Original post by swiftcoder
Quote:Original post by ma_hty
Display list is usually as good as static VBO (at least on a NVidia display card).
I am going to go out on a limb here and say that this is incorrect. For small amounts of data, you may be right - but in the OP's case, he is most likely bandwidth-limited, and saving the transfer of vertex data every frame should help a lot.


I really don't want to start a discussion about it in the first place because I don't really have any official spec about it. However, from my experience, the display list does have some kind of optimization to save the transfer of vertex data.

You can verify it easily. Get a big 3D model (at least 100 MB in file size), and draw it using display list, vertex pointer and VBO.

[Edited by - ma_hty on May 16, 2008 10:15:52 AM]
I am trying to use display list, because I want to see the benefit of them. However, the code I am dealing with is rather tricky. It is a mixture of Fortran 77 (I know...) and C and If I may I am going to describe it here:

from fortran, I do

call XFtnDisTriCol(GC3, tris(1,kx), 1, snorm, xyz, iwk3, cmap, ntri, 0, norflg)

and from C I have
XFTNDISTRICOL(Window *window, int *endpts, int *skip, float norms[][3],
float vert[][3], int ci[][3], float cmap[][3],
int *n, int *mirror, int *nf)
{
static int surf = 1;
int i, mir, ninst, ni, nx;
float col[4];

// Block 1
if ((XFtnXparVal != 0.0)) {
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
for (ni = 0; ni < ninst; ni++) {
if (*mirror < 0) {
XFTNAPPLYXFORM(&surf, ∋, &ninst);
if (pV3_inst != NULL)
if (pV3_inst[ni] == 0) continue;
}
if (*nf == 0) xftnFixNor(norms[0], mir);
nx = 0;
glBegin(GL_TRIANGLES);
for (i = 0; i < *n; i++) {
if (*nf != 0) xftnFixNor(norms, mir);
xftnFixCol(cmap[ci[0]], col);
col[3] = XFtnXparVal;
xftnColor4fv(col);
xftnFixPos(vert[endpts[nx]-1], mir);
nx++;
xftnFixCol(cmap[ci[1]], col);
col[3] = XFtnXparVal;
xftnColor4fv(col);
xftnFixPos(vert[endpts[nx]-1], mir);
nx++;
xftnFixCol(cmap[ci[2]], col);
col[3] = XFtnXparVal;
xftnColor4fv(col);
xftnFixPos(vert[endpts[nx]-1], mir);
nx += *skip + 1;
}
glEnd();
}
glBlendFunc(GL_ONE, GL_ZERO);
glDisable(GL_BLEND);

} else {

// Block 2
for (ni = 0; ni < ninst; ni++) {
if (*mirror < 0) {
XFTNAPPLYXFORM(&surf, ∋, &ninst);
if (pV3_inst != NULL)
if (pV3_inst[ni] == 0) continue;
}
if (*nf == 0) xftnFixNor(norms[0], mir);
nx = 0;
glBegin(GL_TRIANGLES);
for (i = 0; i < *n; i++) {
if (*nf != 0) xftnFixNor(norms, mir);
xftnFixCol(cmap[ci[0]], col);
xftnColor3fv(col);
xftnFixPos(vert[endpts[nx]-1], mir);
nx++;
xftnFixCol(cmap[ci[1]], col);
xftnColor3fv(col);
xftnFixPos(vert[endpts[nx]-1], mir);
nx++;
xftnFixCol(cmap[ci[2]], col);
xftnColor3fv(col);
xftnFixPos(vert[endpts[nx]-1], mir);
nx += *skip + 1;
}
glEnd();
}
}

}

the xftnFixCol functions fix the colour (no opengl calls)
the xftnColor3fv makes sure that the color is between 0 and 255 and then call glColor3ubv
xftnFixPos calculate the vertex position and call glVertex3fv


My implementation for Block 1 is

iflag = 1; list1=0;
get_listflag_(&iflag,&list1); // list1 is stored in a common block in the fortran
if (list1==0)
{
listName1 = glGenLists (1);
glNewList(listName1, GL_COMPILE);
fprintf(stderr, "In XFTNDISTRICOL 1\n");
glBegin(GL_TRIANGLES);
for (i = 0; i < *n; i++) {
if (*nf != 0) xftnFixNor(norms, mir);
xftnFixCol(cmap[ci[0]], col);
col[3] = XFtnXparVal;
xftnColor4fv(col);
xftnFixPos(vert[endpts[nx]-1], mir);
nx++;
xftnFixCol(cmap[ci[1]], col);
col[3] = XFtnXparVal;
xftnColor4fv(col);
xftnFixPos(vert[endpts[nx]-1], mir);
nx++;
xftnFixCol(cmap[ci[2]], col);
col[3] = XFtnXparVal;
xftnColor4fv(col);
xftnFixPos(vert[endpts[nx]-1], mir);
nx += *skip + 1;
}
glEnd();
glEndList();
list1 = 1;
iflag = 1;
set_listflag_(&iflag,&list1);
}
else
{
glCallList(listName1);
}

So the idea is that the first time the code execute the bloack, it initialise the display list. Then it uses it.

I am sorry for this rather tedious explanation and ugly code, but, hey, I don't have the choice....


I did this implementation in 3 functions, so I have 6 display lists. As a results, Some of the surfaces are drawn properly whereas some others are simply not drawn in color.... just transparent. When the model gets re-drawn, due to some rotation, for instance, I get the same result. So it is kind of work, but not completely.

Question: Can anyone spot any fundamental error that would explain why the code does not behave as the original one, ie without the display lists? I would like to know if the fact that vertices and colors are constantly changing their states and not in a direct block but in functions that are called could be the problem...

Any thoughts?

-Pierre.


This topic is closed to new replies.

Advertisement