PDA

View Full Version : Finite Element Display List use?



joolz
06-20-2005, 01:15 AM
Hi guys

Newbie question :-)

I have a 3D Finite Element model that is made from multiple parts.

At each vertex there is a scalar data value that will be used to render the face polygons with various colours.

I want the ability to quickly turn on/off parts and change the vertex colours based on user defined limits (User has a colour band that they can change).

I can pre-calculate the external faces for each part and store in a display list. Basically a bunch of glVertex3f commands

I assume that this will be the best way to quickly display the parts and be able to turn them on/off (via a nested display list)????

The bit I am not sure about is the rendering based on the data value.

This is the sort of command, I think, I need to use

glColor3f 1, 0, 0: glVertex3f 0, 0, 0

The glColor3* command will vary depending on what the user wants to see. As far as I can tell this will then negate the benefit of having a display list and pre-calculating the glVertex3* commands .

What I am after is a way to 'overlay' the vertex colour information on top of an existing polygon display list (if I am making sense)

I.E the glVertex3* stuff never changes but the glColor3* stuff does.

Is this possible?

I have seen OGL Finite Element apps where the User has a slider which modifies the vertex colours in real time. I can't believe that the glVertex3* stuff is being re-worked.

Obviously I will store the glVertex3* data in an array, but ideally I don't want to recompute the display list

Thanks for any help and hopefully I am making some sort of sense :-)

Julian

jide
06-20-2005, 01:21 AM
If I understood well, each vertex color will change depending on user events. In that case, I'm afraid that display lists won't help you at all.
You have 2 main possibilities: whether you draw in direct mode (Begin (TRIANGLES)... End()) or whether you'll have to use vertex arrays. The second choice might be faster almost if you use VBO.

joolz
06-20-2005, 01:38 AM
Many thanks Jide

I haven't started the coding yet. I just want to get my head round the best method to use.

I don't want to go down the wrong path and end up having to re-code.

Thanks for the pointers - I am looking through the Red and Blue books now :-)

Julian

Relic
06-20-2005, 03:10 AM
At each vertex there is a scalar data value that will be used to render the face polygons with various colours.If this scalar data is constant for every vertex you can use 1D textures to map these to colors interactively.
All you need to do is to normalize the scalars to lie between 0.0 and 1.0, send them as glTexCoord1f(scalar) per vertex and the user interactive color change is done with texture mapping by downloading a new 1D texture with any scalar to color mapping you like.

jide
06-20-2005, 03:35 AM
Nice Relic. Did you get that from cel shading technique ?

With that way, he might be able to keep display lists. Because 1D textures are very small, he will be able to update the textures instead of the geometry. CopyTexSubImage1D would do the job in a so well manner.

Relic
06-20-2005, 03:40 AM
No, this is just the standard way to color scalar data in any type of app.
glCopyTexSubImage requires to draw the tetxure data somewhere, which is not necessary.
glTexSubImage1D will be the call of choice.

jide
06-20-2005, 03:54 AM
Right, I was going too fast...

joolz
06-20-2005, 06:24 AM
Many thanks guys for taking the time on this.

We have a calculation engine that can take many hours to solve..... BUT

Once solved there will be 3 sets of constant scalar data. The data won't change unless the user re-solves. So the texture map idea sounds great. I guess I would normalise the 3 datasets and just swap them in and out as the user requests.

I.E User request 'plot type A' - data is swapped (might take a couple of seconds) and then the user plays with the colours via the texturemap method (quickly).

Great, more reading methinks....

Thanks again

Julian