views:

245

answers:

1

A OpenGL App I've written acts as a viewer for large data files in a propriety format.

It's pretty simple, it loops through each data set one at a time, drawing each one using a glCallList:

for (all objects in our in our data set)
{
    if (first time drawing this object)
    {
        glNewList(...);
        for (all pixels in object_memory)
        {
          drawpixel(); 
        }
        glEndList();
        glCallList(...);
        delete object_memory
    }
    else 
    {
        glCallList(...);
    }
}

I'm trying to add a feature where I can change the transparency of an individual glCallList. The problem is, the data files are so big that I generate the glCallList and then have to delete the actual data I read from. This brings the memory usage down from 4GB to around 400MB. The use of glCallLists are pretty vital to the speed of the application also, without them it slows to a crawl.

Is there a way I can modify the global transparency of the current matrix before I actually call the list?

Updating the list each time the alpha value needs to be updated isn't an option.

Alternatively is there another method that has the same performance benefits of CallLists but can be updated easily?

I've read about VBO's (Vertex Buffer Objects) before and they sound similar but i'm not sure if my data fit's there application domain correctly.

Any thoughts or opinions would be really appriciated.

Thanks,

~ Brian

+2  A: 

The easiest universal way I can think of to mod the alpha would be through a uniform passed to a vertex or fragment shader.

VBO's might help, but it's a little hard to tell without more info about what you're actually doing... VBO's help when you have more vertices than your bandwidth to the card can handle in a frame - so if you have really complicated meshes (high res terrain for example) they might be what you're looking for.

(In reply to comment) sounds like your DrawPixel routine is implemented in immediate mode, which is really inefficient. Try using vertex arrays instead of glBegin()...glEnd() - I bet you'll see a lot of the same performance improvement you got from draw lists.

Nathan Monteleone
drawPixel just does a glBegin(GL_POINTS); glVertex3d(x,y,z); glEnd(); That data is in a image file of sorts, it's kind of hard to describe. Just xyz data.
Brian Gianforcaro
Having faced a similar problem, I'm with Nathan, shaders are the way to go.Also, if possible, do fewer glBegin/glEnd calls. Begin(POINTS); Vertex3d() a thousand times; End(); should be faster, both when you build the display list, and then you invoke it.
Jay Kominek
a fragment shader is definitly the way to go. you can write something that answers your need in just 3 lines of GLSL.
shoosh
Edited with some more info on the inefficiency of glBegin(); glVertex(); glEnd().
Nathan Monteleone