Click here to Skip to main content
15,879,490 members
Articles / Desktop Programming / MFC
Article

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 169.4K   9.9K   49   28
Lets user create and manipulate 3D DirectX models.

Sample screenshot

Introduction

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.

Background

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.

History

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

License

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


Written By
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
kwon, sung-il3-Jun-15 16:00 
QuestionDirectX Panel Hangs Pin
farhanmirzaaa9-Jun-13 22:43
farhanmirzaaa9-Jun-13 22:43 
GeneralMy vote of 5 Pin
JJMatthews12-Feb-13 23:03
JJMatthews12-Feb-13 23:03 
GeneralMy vote of 1 Pin
vvidov7-Feb-13 4:51
professionalvvidov7-Feb-13 4:51 
GeneralMissing files Pin
David_Leikis26-Apr-05 4:27
David_Leikis26-Apr-05 4:27 
GeneralRe: Missing files Pin
BlackDice26-Apr-05 11:22
BlackDice26-Apr-05 11:22 
General3D in my application Pin
Georgi Petrov16-Jan-05 23:55
Georgi Petrov16-Jan-05 23:55 
GeneralRe: 3D in my application - errors Pin
Georgi Petrov17-Jan-05 0:13
Georgi Petrov17-Jan-05 0:13 
GeneralRe: 3D in my application - errors Pin
BlackDice18-Jan-05 2:48
BlackDice18-Jan-05 2:48 
GeneralRe: 3D in my application - errors Pin
Anki NI25-Jun-07 20:13
Anki NI25-Jun-07 20:13 
GeneralOne more question: libci.lib Pin
Kenan Hrustanovic10-Jul-04 10:52
Kenan Hrustanovic10-Jul-04 10:52 
GeneralRe: One more question Pin
Kenan Hrustanovic10-Jul-04 11:41
Kenan Hrustanovic10-Jul-04 11:41 
GeneralGreat Work! : Selecting of previous objects Pin
Kenan Hrustanovic10-Jul-04 10:10
Kenan Hrustanovic10-Jul-04 10:10 
GeneralA question !! Pin
chenbuaa7-Jun-04 17:11
chenbuaa7-Jun-04 17:11 
GeneralRe: A question !! Pin
BlackDice8-Jun-04 3:45
BlackDice8-Jun-04 3:45 
Well, this was just something to be done using MFC. Actually you wouldn't want to use MFC for any real stuff, like games because MFC will slow it down. Basically you'd create a window (the windows way), create a device, (which will also be your window) then do your stuff. It's kinda hard (for me anyway) starting out, but once you get a sense of how things are set up, it's easy to just keep the code you need and start off with that base code for every project

If it's broken, I probably did it

bdiamond
Generalhi man Pin
abufool23-May-04 4:36
abufool23-May-04 4:36 
Generalhi Pin
abufool21-May-04 9:33
abufool21-May-04 9:33 
GeneralRe: hi Pin
BlackDice21-May-04 9:35
BlackDice21-May-04 9:35 
GeneralRe: hi Pin
abufool21-May-04 10:18
abufool21-May-04 10:18 
GeneralRe: hi Pin
BlackDice21-May-04 10:40
BlackDice21-May-04 10:40 
Generaldisapointed by the comments Pin
toxcct4-May-04 10:36
toxcct4-May-04 10:36 
GeneralRe: disapointed by the comments Pin
BlackDice4-May-04 10:42
BlackDice4-May-04 10:42 
Generalabufool Pin
BlackDice30-Apr-04 2:52
BlackDice30-Apr-04 2:52 
GeneralRe: abufool Pin
abufool30-Apr-04 8:13
abufool30-Apr-04 8:13 
GeneralRe: abufool Pin
BlackDice30-Apr-04 8:20
BlackDice30-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.