hello everyone, i've trying to make a simple object(e.g. a simple robot with arms and legs) in openGL..but i've trouble finding how to write all the vertices within the code..is there any tool we can use to develop the objects separately..and drag the vertice co-ordinates into my program?? thank you

Recommended Answers

All 2 Replies

Well, obviously, you can't hard-code the vertices into your program (your post almost made it sound like that is what you are trying to do). You must store the mesh (list of vertices and polygons) into a file that you can load and display. Or, you should generate simple geometric shapes, such as cylinders, spheres, cubes, etc. which is just a matter of computing vertices from a math formula.

You should look into Vertex Buffer Objects, this is the preferred way to render objects in OpenGL. Usually, for building a 3D model, you either load the vertex buffer from a file (of a standard format), or you generate the vertex buffer for simple geometric shapes, and then, you hand over that vertex buffer to OpenGL (via VBOs) and then you can render the model anytime with a simple OpenGL function call. The main problem here is that saving and loading 3D model formats (especially the more feature-rich and complex formats like 3ds) will require a significant amount of work by itself, so you should look for libraries that can do that for you, and at that point, you might as well use a library for all the rendering too.

Ogre3D is a pretty nice game engine that can load all sorts of 3D model formats and do nice rendering effects. Coin3D is another very good option (and implements to OpenInventor interface) which is easier and faster if you don't need fancy visual effects (it is the kind of renderer you would use for a CAD software, like FreeCAD).

well yeah i was actually trying to do that..thanks for the reply it helped me a lot to understand openGL

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.