PDA

View Full Version : OpenGL and GLUT wireframe help



Kalibr
04-16-2009, 10:46 PM
I am having trouble making a 3d wireframe program in C++ using GLUT. The requirement (amongst other things) is to create a 3d scene of a boardgame, and at it's most basic part, create a viewport with a wireframe representation of the models (I'm doing the board and the pieces) using parallel ortho projection.

Now normally I wouldn't go about signing up to forums for help like this, but the lecture notes I got given are frankly useless, and explain more about trigonometry than actual programming. (even then the code examples they provide are incomplete and in the wrong order)

I went through Nehe's tutorial, but there is no mention of a wireframe anywhere, and they claim I must store the models in a .txt format (easy enough I guess) using a "polygon mesh representation" Something they don't even skim over in the lectures.

I *should* be able to texture map the models once I get the model up and running, there are plenty of tutorials for that, but for now I'm in a jam.

Any help would be appreciated

todayman
04-17-2009, 01:52 PM
To draw a wireframe, call glPolygonMode(GL_FRONT_AND_BACK, GL_LINE) before drawing the geometry, and to go back to filled mode, replace GL_LINE with GL_FILL. In order to apply textures, though, you'll probably need to use GL_FILL.

C++, GLUT, and OpenGL themselves say nothing about how the data is stored on the disk. You read it in, do whatever you need with it, then pass it to OpenGL. Check out vertex arrays, VBOs, and the like (you can probably find tutorials easily, and they're in sections 2.6-2.10 of the spec)

Kalibr
04-17-2009, 05:05 PM
Thanks. Just what I was looking for.