## Recommended Posts

hi i am pretty apt at java and C programming.. recently moved onto openGL of which i have a 'fair' knowledge about.. ok so what i am stuck on is mainly just theory side of stuff.. i want to load up a file, of co-ordinates.. - reading file i find V EASY just how to i make openGL display everything.. glBegin and keep drawing point after point.. i dont see how can you control how many points use in a for loop, or even while. anyone have any idea's on what is the best way to go about it.. please let me know.. thank you. using GLUT heavily too, if that helps thanks

##### Share on other sites
Take a look at NeHe lesson 10

It loads a basic 3d world from a text file, see if you can make anything from it, if not try doing some of the previous tutorials on the site... they should help you on your way with opengl.

Good Luck,
David

##### Share on other sites
If you have a set of coordinates in your file and the order is not likely to change, I would store them in a vector:

struct coord3f{    float x, y, z;};std::vector<coord3f> coordinates;//load your coordinates in your vector...I don't know how your file is formatted, so a simple example:for(int i = 0; i < num_coordinates_in_file; i++){    coordinates.push_back( coord3f() );    coordinates.back.x = x_coord_from_file;    coordinates.back.y = y_coord_from_file;    coordinates.back.z = z_coord_from_file;}//loopglBegin(GL_YOURTYPE);for(int i = 0; i < coordinates.size(); i++)    glVertex3f(coordinates[i].x, coordinates[i].y, coordinates[i].z);glEnd();

##### Share on other sites
ok i pretty much can read in triangles, this can be used to build up my scene like lighhouses, houses, etc is my understanding.. correct me if i am wrong please?
-- looked over at NeHe find that out --

ok i need to now from the file, specify facet windings how do i do that, and know vaguely what they are, they make up an edge of objec.. but more detail would be awesome

thanks guys

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628368
• Total Posts
2982293

• 10
• 9
• 13
• 24
• 11