Click here to Skip to main content
15,396,540 members
Articles / Desktop Programming / MFC
Posted 29 Mar 2004


49 bookmarked

A beginning DirectX application using MFC.

Rate me:
Please Sign up or sign in to vote.
4.71/5 (33 votes)
29 Mar 20042 min read
Lets user create and manipulate 3D DirectX models.

Sample screenshot


This project lets you create 3D models using DirectX's helper functions. You're also able to manipulate pre-made .x files. You can also save the models you create yourself as .x files in binary, compressed, or text format. I started off using the DirectX 8 SDK. I now have version 9 and have changed required #includes to make it work.


I ordered a book a few months ago that came with a CD with a demo version of a 3D modeling package, but I didn't get the CD. So I decided to try to write my own. Never thought that it would take as much as it did! This is by no means a fully functional 3D modeling program. But for anybody interested in DirectX game programming, maybe they can look at some of my code (as beginner-level as it is) and it'll help them.

Using the code

All of the objects are derived from a class, CMesh which is a wrapper for DirectX's mesh object. There is a CScene object used for containment of all the mesh objects. CScene has a method called Render() which loops through all of the CMesh- derived objects and draws them to the screen. The picture box that I'm using as a device for the Direct3D presentation of the objects was derived from class CStatic and drawn dynamically so that you can get the events that you wouldn't normally get with a regular picture box. The toolbars are drawn with the help of code that was obtained from MSDN. To display an object, click the object type you want to draw first, then click 'Add object' button. Anytime after the object is selected, you may click on options to change different characteristics of the object. There is no support for textures or animation. To rotate an object more freely, you should click the appropriate rotate button, then since it is now default, hold down 'Enter' button on your keyboard to prevent having to click button again. When copying and pasting an object, click one of the translation buttons to see the object move, since new object will be copied directly in the same spot as the previous object. You can only perform operations on the current object.

Points of Interest

I had a problem when moving from one hard drive to another with the path to my mfc\include directory specified in the Modeler.hpj file. No doubt your path is different also. You'll have to manually edit the text of that file to point to the correct folder.


First release - I don't really plan on finishing it, but I just hope it helps anyone the way it is!


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Web Developer
United States United States
Started off with vb6 Smile | :) and am self-taught at C++, FoxPro, DirectX, etc. I'm currently developing with VFP9 and C# in desktop apps, webservices, telephony apps.

Comments and Discussions

Questionq : Image quality Pin
kwon, sung-il3-Jun-15 16:00
Memberkwon, sung-il3-Jun-15 16:00 
QuestionDirectX Panel Hangs Pin
farhanmirzaaa9-Jun-13 22:43
Memberfarhanmirzaaa9-Jun-13 22:43 
GeneralMy vote of 5 Pin
JJMatthews12-Feb-13 23:03
MemberJJMatthews12-Feb-13 23:03 
GeneralMy vote of 1 Pin
vvidov7-Feb-13 4:51
Membervvidov7-Feb-13 4:51 
GeneralMissing files Pin
David_Leikis26-Apr-05 4:27
MemberDavid_Leikis26-Apr-05 4:27 
GeneralRe: Missing files Pin
BlackDice26-Apr-05 11:22
MemberBlackDice26-Apr-05 11:22 
General3D in my application Pin
Georgi Petrov16-Jan-05 23:55
MemberGeorgi Petrov16-Jan-05 23:55 
GeneralRe: 3D in my application - errors Pin
Georgi Petrov17-Jan-05 0:13
MemberGeorgi Petrov17-Jan-05 0:13 
GeneralRe: 3D in my application - errors Pin
BlackDice18-Jan-05 2:48
MemberBlackDice18-Jan-05 2:48 
GeneralRe: 3D in my application - errors Pin
Anki NI25-Jun-07 20:13
MemberAnki NI25-Jun-07 20:13 
GeneralOne more question: libci.lib Pin
Kenan Hrustanovic10-Jul-04 10:52
MemberKenan Hrustanovic10-Jul-04 10:52 
GeneralRe: One more question Pin
Kenan Hrustanovic10-Jul-04 11:41
MemberKenan Hrustanovic10-Jul-04 11:41 
GeneralGreat Work! : Selecting of previous objects Pin
Kenan Hrustanovic10-Jul-04 10:10
MemberKenan Hrustanovic10-Jul-04 10:10 
GeneralA question !! Pin
chenbuaa7-Jun-04 17:11
Memberchenbuaa7-Jun-04 17:11 
GeneralRe: A question !! Pin
BlackDice8-Jun-04 3:45
MemberBlackDice8-Jun-04 3:45 
Generalhi man Pin
abufool23-May-04 4:36
Memberabufool23-May-04 4:36 
Generalhi Pin
abufool21-May-04 9:33
Memberabufool21-May-04 9:33 
GeneralRe: hi Pin
BlackDice21-May-04 9:35
MemberBlackDice21-May-04 9:35 
GeneralRe: hi Pin
abufool21-May-04 10:18
Memberabufool21-May-04 10:18 
GeneralRe: hi Pin
BlackDice21-May-04 10:40
MemberBlackDice21-May-04 10:40 
Generaldisapointed by the comments Pin
toxcct4-May-04 10:36
Membertoxcct4-May-04 10:36 
GeneralRe: disapointed by the comments Pin
BlackDice4-May-04 10:42
MemberBlackDice4-May-04 10:42 
Generalabufool Pin
BlackDice30-Apr-04 2:52
MemberBlackDice30-Apr-04 2:52 
GeneralRe: abufool Pin
abufool30-Apr-04 8:13
Memberabufool30-Apr-04 8:13 
GeneralRe: abufool Pin
BlackDice30-Apr-04 8:20
MemberBlackDice30-Apr-04 8:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.