Archived

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

To do or not to do... Implementing a few classes.

This topic is 5813 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I started implementing a few classes to represent meshes (objects)... I have a Vector class contains things suchs ass x, y, z, color info etc... I have a Triangle Class, the triangle class has a few methods to set the vertices of teh triangle and to get the vertices of the triangle. The setMethods receive 3 vetor references. Bassically like using the indexing to the vectors... Now in my mesh class a I have such a function called draw... This function goes through each triangle and gets the 3 vertice values and puts them into an array, once that array is full I then use glDrawElelements to draw the mesh on screen... The code is nice and modular. But I would assume that going through x amount of tris and getting the vertice values to create my vertex buffer is killer??? So it would be safer to just automatically from load time store each x,y,z value in the array directly??

Share this post


Link to post
Share on other sites
One minor thing: I would call it a Vertex and not a Vector. A 3D vector has x,y,z nothing more, nothing less. A vertex might need more data like color, texture coordinates, etc.

Now on your design, if you are interested in high performance you should definately put your vertices into an array at load time. Unless this is impossible, for example with a highly dynamic mesh. But even then, you should create the vertex buffer at load time and update the vertices in it when needed.

Share this post


Link to post
Share on other sites
Well the fisrt time I posted abot a vertex class all pppl got weird and freaky on me about the name... That is why I said vector instead so no one goes all wako and shit!

Anywhooo.....

I think we an array you can still have a highly dynamic mesh... You just acees teh array with an index at every 3 position since the array will store the values as [x, y, z, x, y, z ....] and you modify the values as you wish... And for LOD, unless it is compute mathematically. you can have a dynamix array taht resizes... But LOD I thinks is implement 1 array per LOD level..... No?

Share this post


Link to post
Share on other sites