PDA

View Full Version : reads a set of vertices from a file



David22
12-04-2009, 07:53 AM
hey all..
i just want to ask how to read a set of vertices representing an object from a file..and draw the given object??

thank u

Dark Photon
12-04-2009, 09:10 AM
i just want to ask how to read a set of vertices representing an object from a file..and draw the given object??
For the former, that's totally up to you and outside the scope of OpenGL.

For the latter, google OpenGL tutorials. NeHe and Lighthouse are a few good ones.

David22
12-04-2009, 10:06 AM
i don't know what u mean .. but i need the way to read a vertices ...of lines from an existing file and draw it!!

Aleksandar
12-04-2009, 10:12 AM
David, do you realize that your question is totally meaningless? :(

David22
12-04-2009, 10:15 AM
ok i will explain more..lol ..

i have a homework to read a point from a file by the OpenGl .. and draw the line (glVertix) but the readen point from a file (existing text file) ... now it clear???

David22
12-04-2009, 10:17 AM
so if the text file includes

3 4
5 6
7 8
4 7
the openGl with draw lines with the given point .. .(3,4) , (5,6) .. and so on...

Aleksandar
12-04-2009, 10:22 AM
Still it is NOT an OpenGL question!

How about changing the forum?
Reading from the file depends on programming language, and if you have a homework to draw a line, I guess that your teachers have shown you how to read data from file...

David22
12-04-2009, 10:26 AM
eee...no .. so u can't help me ?? i don't know!!

mark ds
12-04-2009, 10:31 AM
What programming language do you use? That would be a good start...

David22
12-04-2009, 10:33 AM
c++..and thank u very much

MaxH
12-04-2009, 06:06 PM
so if the text file includes

3 4
5 6
7 8
4 7
the openGl with draw lines with the given point .. .(3,4) , (5,6) .. and so on... I have a suggestion which will divide your assignment up into a C++ programming part, and an OpenGL graphics part. The C++ part will be reading the data in from a text file. The OpenGL part will be plotting the line. Try to write an OpenGL/C++ program that plots a line from points defined in an array. Use the coordinates you list above, put them into an array using simple assignment statements (not reading them in from a file), and plot them. If you can do that, you're 3/4 done with your assignment. If you can't do that, you'll at least be able to ask the forum some specific, OpenGL-related questions. See NeHe Tutorials 1 & 2 for source code to open up an OpenGL window, set up coordinate systems, etc.

Good luck.