
How to make a Model Editor
Well, for a while now I''ve been searching on the internet on how to approach making my own Model Editor, but i really don''t know where to start. I think my biggest question is, "how do I make a function to mesh the objects?" How could a make a 3D sphere and modify it''s vertices? Would I just have to make my own function to draw a sphere or could i use OpenGL''s pre-built functions to draw a sphere. Although, I figure that if I use GL''s pre-built functions I wouldn''t be able to do much modifying with each vertex, right? I''d really appreciate the help

Languages: C/C++ C# JavaAPIs: Win32 OpenGL DirectXWeb: javascript Perl JSP PHP-MySQL Oracle Database Programming</span><a href='http://www.ethereal-studios.com'>http://www.ethereal-studios.com</a></a>
There doesn''t exist any "OpenGL''s pre-built functions". OpenGL can *only* draw primitives (points, lines, triangles, quads, and convex polygons). You have to use libraries of a higher level (like GLU or GLUT) for "pre-built functions".
But what you noticed was true : you can not modify the vertex with those "pre-built" objects. In fact, you can modify a little bit of them (for example you can modify the radius of a sphere, of course) but that''s not enough for editing each mesh vertex, one vertex after the other.
I recomend to create your own mesh structure.
Think about such a structure as if you had to draw it using OpenGL''s vertex arrays : there is a list of "points", each "point" having a set of coordinates (2D/3D coordinates, plus maybe color coordinates, plus maybe normal coordinates, plus maybe texture coordinates, etc), and there is a list of "polygons" whose corners are known by index arrays referencing the list of "points".
There exist other structures, but that one has many advantages.
But what you noticed was true : you can not modify the vertex with those "pre-built" objects. In fact, you can modify a little bit of them (for example you can modify the radius of a sphere, of course) but that''s not enough for editing each mesh vertex, one vertex after the other.
I recomend to create your own mesh structure.
Think about such a structure as if you had to draw it using OpenGL''s vertex arrays : there is a list of "points", each "point" having a set of coordinates (2D/3D coordinates, plus maybe color coordinates, plus maybe normal coordinates, plus maybe texture coordinates, etc), and there is a list of "polygons" whose corners are known by index arrays referencing the list of "points".
There exist other structures, but that one has many advantages.
Full tutorial on OGLM (OpenGL Modeller) at www.CornflakeZone.com
if you''d like the latest code you''ll have to wait until my desktop comes back from the repair shop ;-(
if you''d like to add to the code feel free and send me the update.
http://www.CornflakeZone.com
//-- Modelling and animation in every dimension --//
if you''d like the latest code you''ll have to wait until my desktop comes back from the repair shop ;-(
if you''d like to add to the code feel free and send me the update.
http://www.CornflakeZone.com
//-- Modelling and animation in every dimension --//

Yea, that site''s awesome. I was just looking at the code. Is there a tutorial page on that...? hmm... i didn''t know! Thanks, I''ll check it out!
*bangs head on computer seeing that what he was looking for was right in front of him* hehehe...
*bangs head on computer seeing that what he was looking for was right in front of him* hehehe...

Languages: C/C++ C# JavaAPIs: Win32 OpenGL DirectXWeb: javascript Perl JSP PHP-MySQL Oracle Database Programming</span><a href='http://www.ethereal-studios.com'>http://www.ethereal-studios.com</a></a>
Time for another Good Idea and Bad Idea
---------------------------------------
Well, since I dont'' have school right now... playing sick...
And since I brought my Calc book home from school I was wondering something, (while I''m in the mood to do math), should I find all the vertices for basic primitive shapes and write them down on a graph right now and use those vertices to make all my shapes in a modeler program? Is that how you do it... cuz if it is than I''ll get out my graph paper now. I''m downloading that Cube to Sphere program too, that seems cool how you found the vertices.
---------------------------------------
Well, since I dont'' have school right now... playing sick...

Languages: C/C++ C# JavaAPIs: Win32 OpenGL DirectXWeb: javascript Perl JSP PHP-MySQL Oracle Database Programming</span><a href='http://www.ethereal-studios.com'>http://www.ethereal-studios.com</a></a>
You gotta compute vertex coordinates on-the-fly, eg let the computer find them every time you create a new primitive.
The models you create shall begin as a simple primitive. Then this pimitive will be stretched in many ways : you''ll add, remove or move some vertex wherever and whenever you want. That''s one method for building shapes.
The models you create shall begin as a simple primitive. Then this pimitive will be stretched in many ways : you''ll add, remove or move some vertex wherever and whenever you want. That''s one method for building shapes.
Should I represent each vertex as a node? Making a linked list? That way I''d be able to attach and detach nodes... would that work?
Languages: C/C++ C# JavaAPIs: Win32 OpenGL DirectXWeb: javascript Perl JSP PHP-MySQL Oracle Database Programming</span><a href='http://www.ethereal-studios.com'>http://www.ethereal-studios.com</a></a>
Yes that would work.
It is a very powerful way for removing/inserting vertex, but also it costs some extra memory.
It is a very powerful way for removing/inserting vertex, but also it costs some extra memory.
Do you think to generate multiple objects of the same type, or even vertices I should use the template. For example
vector obj(numObj);
or something like that,haven't figured out how I'm gonna do it. That way I can update the different objects array during runtime AND display them with a for loop or something like this
vector::iterator iObj;
iObj = obj.begin();
while(iObj!=obj.end() {
// do whatever
}
Anyone think that type of coding would work. If not, what's another way I can keep generating new objects effectively?
-- Sorry, i know this code isn't well thought out...
Edited by - DJ_GL on January 23, 2002 2:27:07 PM
vector
or something like that,haven't figured out how I'm gonna do it. That way I can update the different objects array during runtime AND display them with a for loop or something like this
vector
iObj = obj.begin();
while(iObj!=obj.end() {
// do whatever
}
Anyone think that type of coding would work. If not, what's another way I can keep generating new objects effectively?
-- Sorry, i know this code isn't well thought out...
Edited by - DJ_GL on January 23, 2002 2:27:07 PM
Languages: C/C++ C# JavaAPIs: Win32 OpenGL DirectXWeb: javascript Perl JSP PHP-MySQL Oracle Database Programming</span><a href='http://www.ethereal-studios.com'>http://www.ethereal-studios.com</a></a>
Here''s my take on things. Essentially, there''s two ways you want to be able to organize your data:
1) The way the modelling tool will use it
2) The way your end product or game will use it.
with 1) you want to use a structure that can slice and dice things effectively, re-organize and group the data. Smooth it, interpolate vertices and other good stuff to create the model. You''ll also want to implement some form of hierarchical structure for skeletal animation or logically grouping the vertices (knee bone is connected to the leg bone etc.) This structure is probably not that critical to optimize from a memory perspective.
Then with 2) you''ll want to optimize drawing the vertices, memory storage and animation. You''ll not really care if the structure makes it difficult to change the model''s structure but you will want to be able to shoot it off to the openGL pipeline fast.
I''m tired now, time for bed.
-fs
http://www.CornflakeZone.com
//-- Modelling and animation in every dimension --//
1) The way the modelling tool will use it
2) The way your end product or game will use it.
with 1) you want to use a structure that can slice and dice things effectively, re-organize and group the data. Smooth it, interpolate vertices and other good stuff to create the model. You''ll also want to implement some form of hierarchical structure for skeletal animation or logically grouping the vertices (knee bone is connected to the leg bone etc.) This structure is probably not that critical to optimize from a memory perspective.
Then with 2) you''ll want to optimize drawing the vertices, memory storage and animation. You''ll not really care if the structure makes it difficult to change the model''s structure but you will want to be able to shoot it off to the openGL pipeline fast.
I''m tired now, time for bed.
-fs
http://www.CornflakeZone.com
//-- Modelling and animation in every dimension --//

This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement