PDA

View Full Version : GL_TRIANGLE_STRIP Algorithms anyone??



cutting_crew
03-03-2004, 01:14 PM
i am looking for a nice generic piece of code to render terrain using GL_TRIANGLE_STRIPS. for instance if you have an array of structs, each member of the struct contains an x , y , z coordinate and i store them into this array of structs what would be a good way of using glVertex3f to draw the terrain using the above mentioned? .. thanks so much in advance?

oh yeah here is my problem. i have some data, 204*100;

in mydata for example i have stored all the info. the first element would be..

myData.x[0], myData.y[0], myData.depth[0].

where 0 goes from 0 - (204*100); i would like to use GL_TRIANGLE_STRIPS to draw them out.. thanks you guys so much in advance!

chemdog
03-06-2004, 01:17 AM
If the x, and y coordinates are organized on a grid you can march up and down the columns adding the corners of each row to the vertex list.
You may have better luck using indexes, and the corresponding functions.

If it's not on a regular grid then, you need to try to planarize the graph. Then try to convert the planar graph to psuedo-grid coordinates. Then march up and down the pseudo-grid columns.