Making a 3d Modeller

I’m looking to make a program similiar to 3d Studio Max…they layout anyways…I want to know where the best place to start is. I want to have the 4 display windows probably using a splitter, and have the toolbar on the left side rather than the right. I would also like to have the menus for exiting and saving etc. displayed along the top. Any suggeestions of sites to start reading about, etc?

  • Derek

For starters, I would recommend using a visual development environment that would allow you to create your main window at design time, such as C++ Builder or Delphi. In 5 minutes, you can have your complete menu bar, toolbars with buttons, and main window with splitter.

Next you should create a solid set of classes for managing the file new, open, and save commands. I would recommend setting up your program to treat 3D files just like Word treats Word documents, as far as the actions that take place when you open a new file, modify it, and do things like close the window without first saving your file, which on good software will bring up a dialog asking you if you want to save it. Also implement some kind of Most Recent File list. This will help you when you are creating test model files.

You may want to test your file management classes by creating a simple text editor before you dive into the 3D stuff.

Once you have your basic user interface layed out and have your file management classes working, you should determine exactly what data your 3D modeler will be dealing with. Of course vertices are involved. Do you want your modeler to support non-triangular faces? Textures? Texture tints? Is your modeler going to create just a model or will the model have lights associated with it? There are many factors.

Will you be using common file formats such as 3DS? I have found that it is easier for me to design my own file layout than to try to learn the layout of someone else’s and then write an importer for it. If you design your own file layout you should provide an API to read the file contents.

In order to have periods of pleasure from feeling like you accomplished something, you will want to make your modeler in steps.

  1. Make user interface

  2. Make file management classes

  3. Make text file editor

  4. Copy text file editor, strip out text-specific stuff, add 3D API initialization and finalization code to your app’s startup and cleanup sections

  5. Determine what will need to be initialized and finalized for each model (arrays, view matrixes, default camera & light positions, etc)

  6. Test initialization code before trying to render anything. MAKE SURE YOU CHECK THE RESULT OF EVERY FUNCTION SO YOU CAN QUICKLY DETERMINE THE SOURCE OF ERRORS. Also make sure your program, when it has an error, gives the user a detailed description of what the program was trying to do and also a user-friendly description of the error code meaning. You may also want to include the numeric error codes or make error code translator functions to give the symbolic name of the error code. Writing lots of error checks helps both the programmer and the end user

  7. Have the program add vertices and faces without user intertion in order to test the rendering code

  8. Add user interface components and code to allow user to add faces and modify the vertex positions and vertex/face colors

  9. Add user interface components and code to allow user to remove vertices and faces from the model. Make sure the program can handle the user removing everything from the model

… I have to go, I will post some more tonight or tommorow.

If you get that far, post another question here for me.

I understand all that…I just have no idea where to start on the code.

Like, should the project be MFC, an SDI or MDI app, etc.?

Where do I place the rendering code for a win app like this?

Where are tutorials about this kind of stuff?

I understand how I’m going to set it up so that the user can add vertices and such, but no idea how to go about making say a text box, to read in the value of say the x coord for the vertice, etc.

I’m new to opengl and to win32 coding, but I coded A LOT in DOS

  • Derek

What about begin with the beginning ???
You have many tutorials to learn OpenGL

If you want to create you’r own 3DS, choose an API to create the interface because you won’t make a beautifull interface with ogl.

What about using Visual C++ 6.0, QT for the interface and OGL for the rendering ?

JC: That’s exactly what I plan on doing. I just don’t know where to start on doing something like that. I mean I understand opengl…I’ve worked my way through the nehe tutorials.

I just know crap all about win32 coding for gui’s and stuff. I plan on using VC6.0 so any help would be appreciated…

  • Derek

Sounds like you are an experienced programmer who is inexperienced in Windows programming. What you need is a solid learning book on MFC, if that is what you plan to choose.

I’m no MFC C++ programmer, but to keep your code simple, use the SDI app template instead of the MDI app template.

SDI = Single Document Interface
MDI = Multiple Document Interface

The difference between SDI and MDI is that MDI has normal windows inside the app’s main window. An example would be Microsoft Word. SDI is just the main window alone. An example of that would be WordPad.

As I said before, you should be very fluent in MFC before trying to tackle making a 3D modeler. Anybody have any books they would like to recommend to Derek?

Maybe this will help get you started.
The url

Hey, sounds like you need my site : aka The Cornflake Zone.
I’ve pretty much developed what you’re talking about. MFC + VC6.0++ + OpenGL = the OGLM or OpenGL Modelling Tool. I’m also working on inverse kinematics and camera motion paths etc. Let me know if you have any questions:

Francis Shanahan