Newbie questions with further guidance

Hello , currently we are learnning openGL at school under Windows using GLUT for the windowing and use GLM for loading the model. My knowledge is very thin at this moment which is why I ask these newbie questions. My questions are:

  1. given a certain model in .obj(one that wasn’t designed by me) format is it possible to animate the model , or does the model need to come with something additional (extra information in the .obj file ) ? 2.if it is possible can you please redirect me to a step by step guide into how to get started?(basic concepts, guidelines, anything to get me started) 3. can I also apply texture or does the .obj file requires some additional information when making the model in a CAD tool?
    Thank-you in advance
  1. No. obj’s don’t have any rig information, so if you mean animate like deforming a skeleton, that’s not going to work

  2. n/a

  3. objs have texture coordinates built into them, so you can apply textures to them or use automatic mapping if you want a simple texture applied.

On the other hand if, by ‘animate’, you mean moving the entire model around on the screen WITHOUT deforming it, that is very straightforward. Some obj files have texture coordinates in them. Some do not. It’s an option given to the user when the file is created. It’s easy to tell if texture coordinates are there. Look in the file for lines beginning with ‘vt’. Also, go to the Wikipedia discussion of obj files. It’s discussed quite clearly there.

thank-you for your answers. I have googled up a bit some of the terms like rigging and have understood something among these lines: in order to make the model to be animated in openGL I must open the model in a 3d editor (at school they told us about gmax) detach the pieces that I want to animate and "animate " them in the program then somehow export the model with that additional information. Is this idea doable? If it is can you please guide me to further accurate documentation on how to achieve this? (the editor doesn’t actually need to be gmax, the process just needs to be as simple as possible because I only want to animate some basic movement of the model).

A car rolling along with its wheels turning can be considered ‘animated’. This could be done very easily in OpenGL without rigging because no parts of the car are changing shape. A giraffe moving it’s head from side to side by bending its neck would require some sort of rigging, because its neck is actually changing shape. Which type of animation R U doing? Can you achieve the desired effect by just moving and rotating pieces of a model? It would much easier that way.

Another simple way to do animation, is to export the model at several animation stages, each would become a “keyframe”.
Then in your program, load 2 versions of the model, and linearly interpolate each vertex postion, from version 1 to version 2.
This works only if you do not change the topology of the model between keyframes, only position of vertices.

You can try higher-order interpolation for smoother movement if needed, ie. Hermite has good properties for keyframe interpolation.

I have a bear as a whole and I want for it to be able to move (the way I see it only rotations of it’s limbs are needed, the movement doesn’t have to be realistic). The problem that I am facing is with the breaking of the model so that the limbs are different objects. Is there a program who would allow me to do that? (and if you could provide me with the tutorial that’ll e great)

Blender 2.49 :

  • select bear (right click on it)
  • go to Edit Mode (tab)
  • select vertices for a limb (right click on each vertex, keep shift key down do add more than one vertex)
  • separate to a new Part (hit P)
  • exit Edit Mode (tab)
  • make sure only the limb is selected
  • File/Export… to your format of choice, make sure option “export only selected” is select in the export dialog.

Search the web for much more detailed tutorials for each step.

There is a way you can break your bear up into body parts without using a Modeling program. But it’s tedious. You’ll still need a way to view .obj files. Take a look at the bear .obj file with a text editor. If you’re lucky the face definitions might be grouped by body parts, i.e. right leg, left arm etc. Group definitions begin with the letter ‘g’. Let’s say there’s a group called ‘head’ or something similar. Create a new version of this file editing out all ‘f’ lines not in the ‘head’ group. Don’t make any other changes. Look at the new file with an .obj viewer.

If there are no groups defined in the .obj file, you could also try assigning a bright, color, like pure red to a group of faces. You would do this using a text editor. Just search for mtl in .obj file to see how it’s done. Then look at the file with your .obj viewer to see what portion of the model turned red. With trial and error you could break the bear file up into the parts you need. But it would be much easier doing what ZBuffer said with ‘Blender’ or some other geometric modeling program.

there are many tutorial for opengl

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.