Jump to content

  • Log In with Google      Sign In   
  • Create Account

3ds vertex format & OpenGL


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 Xtreme   Members   -  Reputation: 122

Like
Likes
Like

Posted 25 July 2001 - 05:58 PM

hi, I have noticed that 3d Studio converts every single mesh into triangles. So a cube with 6 faces, becomes 12 faces when in 3ds format. So, when I use glBegin(GL_TRIANGLES) to display the mesh in OpenGL, I get triangles form of a cube! arrrghh So, how can I get a proper cube, that is a cube side (basically a square and not 2 triangles?) Is there are way to avoid this problem? Do i have to re-edit the vertex list in the .3ds file to overcome this problem? If so, how can I keep track of how many vertices are used for a face? So, for example if a particular face uses 4 vertices, then i know I will have to start with a GLBegin(GL_QUADS) instead of GLBegin(GL_TRIANGLES) Has anyone faced with this problem? Xtreme.

Sponsor:

#2 sprochet   Members   -  Reputation: 122

Like
Likes
Like

Posted 25 July 2001 - 06:17 PM

If you're using the 3dsftk you can loop through the mesh-list in the scene and get number of faces/vertices/materials/texture coords+++...


assuming you know how to use the 3dsftk:
--
InitDatabase3ds ( &DataBase);
CreateDatabase3ds ( File3DS, DataBase);
GetMaterialNameList3ds ( DataBase, &Materiallist);
GetMeshNameList3ds ( DataBase, &Meshlist);
InitMaterial3ds ( &Material);
--


All you have to do after this is loop through the mesh list and get vertex face props...

--
for (UINT i = 0; i < Mesh->count; i++) {
GetMeshByName3ds(DataBase, Meshlist->list.name, &Mesh);

//Mesh->nvertex = number of vertices
//Mesh->vertexarray = actual array
//Mesh->nfaces = number of faces
//Mesh->facearray = actual array

}
--






woha

Edited by - sprochet on July 26, 2001 1:25:12 AM

#3 sprochet   Members   -  Reputation: 122

Like
Likes
Like

Posted 25 July 2001 - 06:21 PM

btw, why are you obsessing about the quads, all 3ds does is convert a quad into two triangles, which is faster to display..

#4 Xtreme   Members   -  Reputation: 122

Like
Likes
Like

Posted 25 July 2001 - 07:14 PM

sprochet,
I can extract the vertex list, face list etc, using my own program but the problem is, when creating the vertices from the face index and vertex list, i realised that the vertices are
in triangle form. that is, one face is A, B, and C. which makes up a triangle. Currently i use (GL_TRIANGLES) to draw the mesh, it works, but displays triangles into of quads when necessary.

Now the reason why im asking how to make one quad instead of two triangles for a each side of a cube is because whenever I use texture coords for each side, i get the texture split into those 2 triangles!! If it were one, then it would be no problem, but one texture split into 2 triangles looks like crap!


#5 benjamin bunny   GDNet+   -  Reputation: 838

Like
Likes
Like

Posted 26 July 2001 - 03:05 AM

You must be doing something wrong then. Assuming the texture coords are right, one texture split across 2 adjacent triangles on a plane should look identical to one texture on a quad.

A quad is just 2 triangles anyway. That''s all graphics cards work with, so your quads will get converted to triangles somewhere along the line.

Triangles are much easier to work with than other shapes anyway, so you''re better off leaving them like that.

#6 smitty1276   Members   -  Reputation: 560

Like
Likes
Like

Posted 26 July 2001 - 09:40 PM

3DSMax will export the texture coordinates anyway. Are you designing models in 3DS and then texturing them in code?!? Why do that? Just do the models, with textures, in 3DS, and texture coordinates will be generated as well as vertex coordinates, face normals, vertex normals, etc.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS