how to build 3D object?

I wont to build 3D object (eg car,chess board)using OpenGL.
Problem is that,I dont know any function or
method to build the object.
Please tell me,what kind of fuction or method
I must used to do this,Please give some example
sourse code.

hi,

there are several ways for you to accomplish what you seek. you can specify each vertices in 3d space to create your model, or you can build your model in your favourite 3d package and use an exporter to get your .c code to get the vertices positions, normal vectors, texture co-or etc.

In anyway,if you’re going for defining your own vertices in 3d space, i’d recommend you reading the red book which in invaluable.

Yeah,
OpenGL doesn’t have functions for generating a 3D model of anything.

I would go with cmdz’s latter suggestion and build one using a 3D modeling app. Creating a 3D model of an object by specifying vertices to OpenGL would be an enormous task.

Get a little familiar with a 3D modeling package (ex: 3D Studio Max) if you aren’t already so, then read up on parsing the particular format file (.3ds, whatever) and reading the vertices,tex coords, material colors etc from that file into your program.

good luck!

If you are using Windows for development, try:

  • AC3D for an excellent 3D modelling tool. Anim8or is also very good. Use these tools to create your models, and export them in 3DS format.

  • Load the 3DS meshes you created above into a program like Display3DS to learn how it’s done.

Simple objects can be written by hand in code, but complex objects(detailed)need to be done in a 3D modeling CAD program.

nehe.gamedev.net is a good place to start to learn the basics of openGL.

As for CAD, there is Blender(free), AutoCAD, 3D MAX, Maya, etc.
You create the objects with these type of programs then read them in to your openGL program.

The problem with modellers such as 3DS MAX, Maya and AutoCAD is that they’re extremely expensive.

Each costs about $3,000 to $5,000 for a licence, assuming you’re not running a pirated copy. Even the student versions are $$$.

As for Blender, yes it’s free, but the last time I checked the file format was undocumented and 3DS export wasn’t available.

Maybe that’s changed?