View Full Version : surfaces....using triangle strips or meshes
04-29-2002, 10:10 PM
iam new tp open gl, i've got a problem that i have a 2D data set a height field of an area and i have to display a 3D surface.
to be more precise i have to read from a given data file(.dat format)display a 3D surface. the data is stored a 8 bit signed integers.
i have been able to read the data from the file but i don't know how to start making a surface from it........iam confused . should i use triangle strips or meshes.....plz do guide me cause iam in a lot of trouble and i'll be very gratefull if u reply soon.
04-29-2002, 11:23 PM
Use triangle strips - something like this (not tested, not checked just off the top of me head) - change xi, yi for larger or smaller heightfield:
int Heights ;
float xp = 0.0f, yp = 0.0f;
float xi = 10.0f, yi = 10.0f;
for ( int x = 0; x < 256; x++, xp += xi )
yi = 0.0f;
glBegin ( GL_TRIANGLE_STRIP );
for ( int y = 0; y < 255; y++, yp += yi )
glVertex3f ( xp, yp, (float) Heights [x][y] );
glVertex3f ( xp + xi, yp, (float) Heights [x+1][y] );
04-30-2002, 04:20 AM
Use triangle strips and don't use quads. Later when you'll want to add textures, quads will do some "funky" stuff with them that will catch you completely off guard.
need some help. i have to read a data from (*.dat) and display it in 3d. my data include the vertex but i just don't have any idea to display it and reading the data. i want to display the data in 3d. so any idea or help ..
05-12-2002, 09:33 PM
I have a sequence of terrain demos that I wrote. They are available on http://18.104.22.168/miguel/
You will see how to build a terrain in a rather inneficient way, and then it is improved to using triangle_strip in a fairly good manner. I did it this way just for the sake of showing how much better the performance is with strips and how simple it is to convert from quads to triangle_strip or quad_strip.
I just read a gray scale TGA file to create the terrain.
There is no kind of LOD involved here, but I will prolly give my terrain engine with a CLOD algo. after I fix a few things.
I hope it helps. http://www.opengl.org/discussion_boards/ubb/smile.gif
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.