View Full Version : Help needed !

11-29-2005, 08:33 PM
hi all,

I'm just starting to learn openGL and I was wondering if is it possible to create a surface plot using measured data in openGL.

Could anyone help me?

Thank you.

11-30-2005, 05:10 AM
Sure it is. ;)

But please be a bit more specific, because i don't understand in what format the source data is, and how the target scene should look like...

Do you have an array of measured data?
If yes: How much dimensions does it have?
Or is the data in some kind of tree?
If yes: What format does that tree have?
What properties do the elements of the array/tree have?

How would you like those properties and the location in the array/tree mapped onto the surface?

I guess with a grid of quads it would be pretty easy to render a 2-dimensional array of height values.

maybe like this (pseudo-code):

# for 100 x 100 values rendered to an 1.0 x 1.0 surface
zoom = 0.01
zoomLevel = 0.01
left = -0.5
front = 1
for (x=0; x<array.length-1; x++) {
subarray = array[x ];
nextsubarray = array[x+1];
for (y=0; y<subarray.length-1; y++) {
element = subarray[y];
nextelement = subarray[y+1];
elementnext = nextsubarray[y];
nextelementnext = nextsubarray[y+1];
glColor( element.colorProperty);
glVertex(zoom * x , zoomLevel * element.levelProperty, zoom * y );
glColor( nextelement.colorProperty);
glVertex(zoom * x , zoomLevel * nextelement.levelProperty, zoom * y+1);
glVertex(zoom * x+1, zoomLevel * nextelementnext.levelProperty, zoom * y+1);
glColor( elementnext.colorProperty);
glVertex(zoom * x+1, zoomLevel * elementnext.levelProperty, zoom * y );
}i hope this helps. i a bit out of basic opengl commands, beause normally i just feed my own high-level layer with data... ;)