Archived

This topic is now archived and is closed to further replies.

AoErat

Baic Questions - New to OpenGL

Recommended Posts

Hi, Please bear with me, as my questions will no doubt seem very amateurish to you guys. I'm still trying to grasp some of the pretty basic concepts of OpenGL and 3D animation. Anyway, I have a couple basic questions that should clear some stuff up for me: 1. In the code below, does OpenGL simply read the first three "glVertex3f", and assume those create a triangle, and then go on to the next three?
glBegin(GL_TRIANGLES);
glVertex3f(0.0f, 1.0f, 0.0f);
glVertex3f(-1.0f,-1.0f, 0.0f);
glVertex3f( 1.0f,-1.0f, 0.0f);
glVertex3f(0.0f, 1.0f, 5.0f);
glVertex3f(-1.0f,-1.0f, 5.0f);
glVertex3f( 1.0f,-1.0f, 5.0f);
glEnd();
    
2. Generally, how are animations stored in 3d model files? Do they store numbers for rotations of each mesh, etc, or what? 3. Does ASE format support animation? 4. What are U & V coordinates? I know they have something to do with textures, but I'm not sure what. 5. What should be considered when writing your own 3d file format? Thanks much ~ AoErat Edited by - AoErat on November 10, 2001 11:00:44 PM

Share this post


Link to post
Share on other sites
1. Yes.
2. They either store multiple ''frames'' and you interpolate between them (that''s known as keyframe animation) or they reference a number of meshes to bones and use the bones to create different frames.
3. I don''t know.
4. Well, they''re pretty much saying which ''point'' on the texture the current/next vertex is at. Read some of the NeHe tutorials on texturing, they may help you understand.
5. What it needs to do . Yes, that''s vague, but so are you .

[Resist Windows XP''s Invasive Production Activation Technology!]

Share this post


Link to post
Share on other sites
1) Yes. Er, I think I''m pretty darn sure! Anyone want to disagree?

2) Generally speaking there are two main ways of storing animations in a file. The first way stores a seperate mesh for each animation (Like Quake2 .MD2) - so all the vertices and texture coords and everything for each frame are saved to the file. The second way stores all the vertices for the model in groups (Like arm, leg, foot, head, etc) and attaches a bone to each group. The bones are kept in a hierarchy. This is called skeletal animation (Like Q3A .MD3) and each frame in the file just contains information on how the bone moved, so all the vertices are moved with the bone by the program at run-time As a rule though, animation can be stored in a file in any way you want!

3) I do not know And it''s too late for me to bother looking it up for you atm! *g*

4) I am not sure why, but U and V represent X and Y (respectively) texture coordinates. Basically in 3D each vertex which is textured needs to know what part of the texture maps up to that vertex. 0,0 represents the top left of the texture, and 1,1 represents the top right. 0.5,0.5 represents the middle of the texture. This is useful because this way, no matter what size the texture is, we can still match up the same part of the texture proportionally!

5) You should consider what you want the end model to be able to do. So for example, if you want your model to have a seperate texture for each frame (Not really very clever, but you get the idea) you need to take this into account. You will need to store vertices, normals, texture coordinates -and- some way to store animations (If needed). Find some Quake2 model loading code - the net''s littered with it atm what with the opengl game programming book by the guys at gamedev.net having been released *g*. That should give you a better idea as to how to approach creating a model format.

Share this post


Link to post
Share on other sites