|
__Direct3D Tutorial [Updated]__
|
Email
|
| Submitted on: |
1/1/2002 3:37:03 PM |
| By: |
Matt Carpenter
|
| Level: |
Intermediate |
| User Rating: |
By 127 Users |
| Compatibility: |
VB 6.0 |
| Views: |
66211 |
|
(About the author) |
|
|
|
A Tutorial on how to do Direct3D7 Retained Mode Graphics! HTML file and an example! Every line of code is commented and easy to understand. Begin making 3D Games with this article! I WORKED A LONG TIME ON THIS ARTICLE! If you like it, PLEASE VOTE FOR ME on PSC :) I am also planning on putting out a 3D flight simulator soon so keep lookin-
This article has accompanying files
|
 |
| |
Terms of Agreement:
By using this article, you agree to the following terms...
- You may use
this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
- You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.
- You may link to this article from another website, but ONLY if it is not wrapped in a frame.
- You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.
|
Download the tutorial and example source code :)
You may find this example really boring so
make it more exciting your self. Try making a 3D maze! Or maybe a racing game! What? You don't have any clue how? You will if you read this tutorial!
After you read it:
1: Rate this- I'd like to hear what you think!
2: Make your own cool D3D Game
|
|
Download article
Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come
out every day, so no prevention program can catch 100% of them. For your own safety, please:
- Re-scan downloaded files using your personal virus checker before using it.
- NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
- Scan the source code with Minnow's Project Scanner
If you don't have a virus scanner, you can get one at many places on the net
including:McAfee.com
|
Terms of Agreement:
By using this article, you agree to the following terms...
- You may use
this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
- You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.
- You may link to this article from another website, but ONLY if it is not wrapped in a frame.
- You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.
|
Other 19 submission(s) by this author
|
|
Report Bad Submission
|
Your Vote
|
| |
Other User Comments
|
1/1/2002 4:02:46 PM: Burbble
I get an Automation Error on this line:
DD_Main.SetDisplayMode 640, 480, 32, 0, DDSDM_DEFAULT 'Set Resolution and BitDepth (Lets use 32-bit color) (If this comment was disrespectful, please report it.)
|
1/1/2002 5:24:13 PM: Cool
1 Question How Did You Get That Comment To Come Up... If You Can Just Leave A Post That Would Be Great Thanks!! :) And It works Perfectally For Me!! Very Sweet.. Im Still Trying To Figure Out How To Make The Stairs And What Not How You Got It Those Colors and stuff Thanks Bye...Ace1DW1@Hotmail.Com (If this comment was disrespectful, please report it.)
|
1/1/2002 5:44:52 PM: Justin Pinkley
This is a great intro to 3D. Good work! (If this comment was disrespectful, please report it.)
|
1/1/2002 7:01:25 PM: Ace315
what program did you use to make the building.x file? and can this be easily converted to directX 8? (If this comment was disrespectful, please report it.)
|
1/1/2002 7:38:22 PM: Matt Carpenter
Ok, First answer, you may want to try a larger screen resolution, or maybe 16bit color. I used anim8or (www.anim8or.com) to make a 3DS File, then I used a converter to convert it to a directX file. It should be compatilbe with DX8 but I'm not sure. (If this comment was disrespectful, please report it.)
|
1/1/2002 8:03:48 PM: Ty
First off, I'd just love to applaud you. I think that you did an excellent job on creating this tutorial. Also, use of comments is great, and that makes the entire tutorial so much better! (If this comment was disrespectful, please report it.)
|
1/1/2002 10:30:35 PM: Matt Carpenter
Get what comment to come up? the one on the .zip file? click actions, then click 'comment' (if that was what you were asking) (If this comment was disrespectful, please report it.)
|
1/2/2002 2:33:13 AM: Ace1DW1
Yeah The Zip Comment... Ive looked.. THANK YOU SO MUCH... With Both (If this comment was disrespectful, please report it.)
|
1/2/2002 10:07:54 AM: Visualcode
I dont know if this will help but the screen shot looks great and ive wanted to learn 3d stuff for a long time ill give you 5 (If this comment was disrespectful, please report it.)
|
1/2/2002 2:18:54 PM: Ace1DW1
Ive made This Big Sene With Anim8or And I Need To KNow How To Convert To Something Like Building.x??? Website??? Thanks Ace1DW1@hotmail.com (If this comment was disrespectful, please report it.)
|
1/2/2002 2:23:25 PM: Matt Carpenter
Search for a program called Conv3DS. Its a 1996 program by Microsoft. You use it to convert 3ds's to .x's. (If this comment was disrespectful, please report it.)
|
1/2/2002 3:25:10 PM: Ace1DW1
I Have Files Named .an8 umm I Used That Anim8or.exe Thing From The Website Above.... Im Clueless (If this comment was disrespectful, please report it.)
|
1/2/2002 3:29:15 PM: Ace1DW1
What.. I Went To Configure And Now What Do I Put In The 3 Boxes Sorry For Flooding (If this comment was disrespectful, please report it.)
|
1/2/2002 6:12:05 PM: Matt Carpenter
you have to go to 'objects' then go to 'export' then export your file as a 3DS. Then convert it using a free program you can find and dl called Conv3DS (If this comment was disrespectful, please report it.)
|
1/2/2002 6:13:14 PM: Matt Carpenter
it wont convert .an8 files. You have to export them as .3ds's (If this comment was disrespectful, please report it.)
|
1/2/2002 7:51:42 PM: Ace1DW1
How? (If this comment was disrespectful, please report it.)
|
1/2/2002 9:59:44 PM: Matt Carpenter
with anim8or up, click objects, then click export. (If this comment was disrespectful, please report it.)
|
1/2/2002 10:08:12 PM: Matt Carpenter
Well, about 900 ppls look at it, and only 8 rate it... Thanx to you that DID rate it :) (If this comment was disrespectful, please report it.)
|
1/3/2002 5:22:43 PM: Matt Carpenter
9, thanX! (If this comment was disrespectful, please report it.)
|
1/4/2002 1:46:31 AM: RicHagen
Nice work , but it's not cool to complain about the number of votes you receive (If this comment was disrespectful, please report it.)
|
1/4/2002 2:23:13 PM: Matt Carpenter
sorry, being 13 years old and able to win $200 software in one month, and all.. you get the point... (If this comment was disrespectful, please report it.)
|
1/13/2002 7:46:19 AM: Mark Withers
Don't boast about winning stuff... Ive won twice in two months in the past. Infact 3ds to X's was not only developed by Microsoft but a later version was made by Discreet. Developers of "Max studio 4" Conv3DS.exe Anyhow overall it was worth the download... the comenting was good, very basic Direct3D concept... using X files... Graphics not so good but easily improved. Try perhaps changing the rotation speed...I can't exactly remember but did you use Tan, Sin and Cos in this tutorial? Did you know that Conv3DS.exe "Convertor" can also change X files back into .3ds files... this helps when i'm using 3D studio max 4 to make scenes. I'd think this work deserves 4 Globes.... (If this comment was disrespectful, please report it.)
|
1/17/2002 5:34:48 PM: Matt Carpenter
Whatever i say is the wrong thing to say...
(If this comment was disrespectful, please report it.)
|
1/18/2002 2:12:18 AM: Hurrotisrobbo
Hey, don't bag out Matt here about the 'complaint' he made. It was perfectly justified #8) Stacks of people come here, download it, and not acknowledge who's made it... not that fair, ne? すごいのだ! Good stuff, Matt, keep it up! (If this comment was disrespectful, please report it.)
|
1/28/2002 12:10:04 PM: Niels
Great tutorial, thanx for bringing this knowledge to the people :) You got my vote (If this comment was disrespectful, please report it.)
|
1/29/2002 11:26:59 AM: Maniac
Thanks MAtt. This is really cool. (If this comment was disrespectful, please report it.)
|
2/23/2002 5:35:51 PM: Creator of Legolas
I am 14, and Kind of inexperienced with VB. I haven't used the tutorial yet but I will. I will comment when I am done, but so far it sounds great!!!!!!! (If this comment was disrespectful, please report it.)
|
2/25/2002 4:57:54 PM: Roope
I even logged in to vote EXELENT for this, that should tell it all. (For beginners) (If this comment was disrespectful, please report it.)
|
2/28/2002 3:52:29 PM: Chris
This is great ! Have always be looking for this. 5 Stars ! (If this comment was disrespectful, please report it.)
|
2/28/2002 9:47:42 PM: Chris
I would like to know how to Rotate the Camera Up, Not move it up.
Thanks (If this comment was disrespectful, please report it.)
|
3/7/2002 2:30:18 PM: Frederico Machado
Hi!
I really liked your tutorial, and I need your help with lights. Can you help me???
(I made a game with your tutorial, Direct3D 1st person game) it's on PSC (If this comment was disrespectful, please report it.)
|
3/12/2002 6:21:17 AM: <>
Chris: How to rotate camera.
I think it goes something like this:
.AddRotation D3DRMCOMBINE_BEFORE, 1, 0, 0, Sin(5)
(where is ur camera (defined as a frame though...) (If this comment was disrespectful, please report it.)
|
3/12/2002 6:21:47 AM: <>
i am not sure if i did it right by the way,.,... (If this comment was disrespectful, please report it.)
|
3/12/2002 6:24:48 AM: <>
Well i think i am sure it wont work... it should look soomething like this (i think):
.AddRotation D3DRMCOMBINE_BEFORE, 0, 1, 0, Sin(5)
the last part is the angle it rotates... ( ithink :)) (If this comment was disrespectful, please report it.)
|
3/14/2002 8:47:11 PM: Pawnee20
very well done Matt. Been trying to find a way to use my 3d skills as well as my programming language skills to create a RPG. This tutorial really is simple to understand and covers all the basics (lights, frames, meshes). Keep up the good work. 5 stars from me! :-) (If this comment was disrespectful, please report it.)
|
3/25/2002 9:30:22 PM: Brain
Okay i get a run time error '-2005532527 (88760091)', if that means any thing to you. Any way, it dosen't do any thing and the line in question is (If this comment was disrespectful, please report it.)
|
3/25/2002 9:33:49 PM: Brain
Set D3D_Device = D3D_Main.CreateDeviceFromSurface("IID_IDirect3DHALDevice", DD_Main, DS_Back, D3DRMDEVICE_DEFAULT) Can you help me? (If this comment was disrespectful, please report it.)
|
4/9/2002 12:38:38 PM: Darksoft.net
Well done example. Easy to follow, and well commented. I have been looking for a very basic tutorial to start programming in 3d. This is a great start. (If this comment was disrespectful, please report it.)
|
5/2/2002 11:38:58 AM: Feing
Great 3d tutorial, i surfed the web for a long time for one like this. (If this comment was disrespectful, please report it.)
|
5/24/2002 6:07:40 AM: Paul A. Smith
ive looked for ages for such a tutorial... typed it all by hand(and it worked... ;-) )
cant wait to make my own programs...
greetz Paul
ps: 5* from me!!! (If this comment was disrespectful, please report it.)
|
6/5/2002 5:18:03 PM: mark
Thanks for taking the time to share the knowledge , it has already helped me alot. Gave ya five (If this comment was disrespectful, please report it.)
|
6/15/2002 5:21:47 AM: Nathan
very good 3d example lots of help, but what convertor do you use to convert th 3ds files to .x files? (If this comment was disrespectful, please report it.)
|
6/15/2002 7:22:57 AM: Nathan
me again i tried to add my own buildings to it (i made em in 3d studios max) and converted it to .x but when i start it nothin happens its just a white screen. plz help! (If this comment was disrespectful, please report it.)
|
7/16/2002 1:47:32 PM: coder86
Great tutorial, I hope to use DirectX for my PC emulator... (If this comment was disrespectful, please report it.)
|
7/16/2002 2:52:30 PM: Fred Shmurtz
This code is copied from Roel Janssen's 3D ship code also posted here, type '3d ship' in search. (If this comment was disrespectful, please report it.)
|
7/28/2002 7:00:20 PM: angry madman
fred is rite, the code is copied (If this comment was disrespectful, please report it.)
|
8/13/2002 8:25:15 PM: George Vassilenko
THANKS A LOT dude i dident know shir u gave ma a jump start on direct X ive edited your program oh yeah the resolution of the backround has to be smaller or = 320 * 240 for it to look right, i allso added a car and now im racing around the box hehe dont really care if u copied the code. (If this comment was disrespectful, please report it.)
|
8/26/2002 7:07:18 PM: Tim
is there any way to have something, that will hold were the camera position is in numbers (such as: dim xpos as single and then like have the xpos hold were the camera x position is?) (If this comment was disrespectful, please report it.)
|
8/26/2002 8:00:38 PM: Tim
(adding to my last comment above)... i need to have this so i can do something like: if the position = # then it does something (If this comment was disrespectful, please report it.)
|
8/31/2002 9:25:16 PM: Matthew Li (mazzanet)
tim, use vectors: Dim camvec as D3DVECTOR .GetPosition Nothing, CamVec msgbox camvec.x msgbox camvec.y msgbox camvec.z (If this comment was disrespectful, please report it.)
|
9/1/2002 12:42:41 AM:
i get an automation error on: Set D3D_Device = D3D.CreateDeviceFromSurface("IID_IDirect3DHALDevice", DD, BackSur, D3DRMDEVICE_DEFAULT) i tried changing it to RGBDevice but got the same (i don't have a 3d graphics card!!) (If this comment was disrespectful, please report it.)
|
9/1/2002 3:44:57 PM:
for (If this comment was disrespectful, please report it.)
|
9/1/2002 3:47:27 PM:
this is for matthew li... where do i put the .GetPosition Nothing, CamVec msgbox camvec.x msgbox camvec.y msgbox camvec.z...... and is the .GetPosition just: FR_Camera.GetPosition?? (If this comment was disrespectful, please report it.)
|
9/3/2002 8:52:18 PM:
hey, forget the message before, i know how now...... but does anyone know how to have another mesh, & it will be able to move with the camera? (so i could make a character or something) (If this comment was disrespectful, please report it.)
|
9/27/2002 11:34:36 PM:
This is great!!! I give it 10 out of 10! (If this comment was disrespectful, please report it.)
|
12/21/2002 7:13:43 PM: Jefff
Help! When I make a 3ds file and convert it into x with conv3ds it gives an automation error! Do you need to add any parameters to the conv3ds program such as -A? (If this comment was disrespectful, please report it.)
|
12/21/2002 7:14:56 PM: Jefff
Sorry for not explaining my problem to well above. When I have my x file and I load it from vb I get my error. Not when converting it (If this comment was disrespectful, please report it.)
|
12/28/2002 12:40:23 PM:
I keep getting this error when i try and put my own meshes in.... I've tried to change the screen res but still the same err, but on a different line of code. I dunno wats wrong. I used 3ds Max 5 to create the cube for the mesh and i used the converter (conv3ds), then i just tweaked the path of ur code where it said blah blah blah App.path (If this comment was disrespectful, please report it.)
|
12/28/2002 12:43:25 PM:
(conti. of previous, got cutt offf) blah blah blah App.path & "\building.x" ===>>>> blah blah blah App.path & "\box.x". I just cant figure it out. By the way, teh err was Automation something. Great Guid tho, all the way!!! (If this comment was disrespectful, please report it.)
|
12/28/2002 3:29:26 PM:
Sweet code...I Rated it 5! Keep it up! This is awesome! (If this comment was disrespectful, please report it.)
|
1/25/2003 10:32:37 PM: Daniel Kerr (Hawk)
WiCkId!!!! * 5 * (If this comment was disrespectful, please report it.)
|
2/13/2003 12:44:09 PM: vbnick
fine piece of work...congrats.. (If this comment was disrespectful, please report it.)
|
5/25/2003 8:48:37 AM: Thorben Linneweber
Very good! '5 Points
I have one question...
'''''To'''''''ROTATE''''''''''''''
Const Sin5 = 8.715574E-02! ' Sin(5°) Const Cos5 = 0.9961947! ' Cos(5°) FR_Camera.SetOrientation FR_Camera, -Sin5, 0, Cos5, 0, 1, 0
'''''''''' This is to "look" right/left...
But how can I "look" up???
Thank You (If this comment was disrespectful, please report it.)
|
7/12/2003 4:12:44 AM: Blackbrunei
Very nice code, but what i don't get is that there are so mamy directx tutorials that explain the basics but almost none of them explains how to make a REAL game, and do it over and over again, making other games all the time! (If this comment was disrespectful, please report it.)
|
10/1/2003 5:53:15 AM:
Thanks mattels, you could have taught people that don't know how to use anim8or a little, i recommend MilkShape as it can automatically convert the model into a directx file. :D i have 1.6.4 keygen if you want a serial you should be able to find it on the net. (If this comment was disrespectful, please report it.)
|
10/20/2003 12:55:01 PM:
Cool, but i think you r a info thief, a simillar or even an identical tutorial was made by Simon Price, (If this comment was disrespectful, please report it.)
|
10/26/2003 7:20:48 AM:
hey, i liked your article and im new to making games,but im studying and reading a lot. I was wondering if you had any more game or direct x tutorials up your sleeve that i can study thank you. oh please check out my bususness site im thinking of setting up a vb section, making you want to mAKE a book or somethting you want to sell. www.bestbuyonlone4u.com .... (If this comment was disrespectful, please report it.)
|
11/5/2003 1:59:17 PM:
I like well documented code. So I give you a 5. (If this comment was disrespectful, please report it.)
|
11/10/2003 12:00:43 AM: HyperHacker
DD_Main.SetDisplayMode 640, 480, 32, 0, DDSDM_DEFAULT 'Set Resolution and BitDepth (Lets use 32-bit color)
Object doesn't support this action.
*sigh* Why is that all the "wow this is so great best ever 6 stars" ones never work? -_- (If this comment was disrespectful, please report it.)
|
11/14/2003 10:46:07 AM: Einewton
Awesome Work man. Keep it up! (If this comment was disrespectful, please report it.)
|
12/8/2003 9:57:44 AM:
hey this tutorial is lookin real good so far. this is my first try at 3d and this is what ive been lookin for. i give you a five. id appreciate anyone who could tell me where i can find tutorials to start game programing in general email is kickenchicken57@hotmail.com (If this comment was disrespectful, please report it.)
|
12/31/2003 6:36:01 AM:
Great work, I think I actually understand it now! (If this comment was disrespectful, please report it.)
|
1/9/2004 11:50:53 PM: Nightmare
DUDE! This rulez. Thanks a bunch for sharing it with us!!! AWESOME MAN (If this comment was disrespectful, please report it.)
|
4/3/2004 9:33:37 PM:
This is in yellow in the debug
Set D3D_Device = D3D_Main.CreateDeviceFromSurface("IID_IDirect3DHALDevice", DD_Main, DS_Back, _ D3DRMDEVICE_DEFAULT) 'Tell the Direct3D Device that we are using hardware rendering (HALDevice) instead (If this comment was disrespectful, please report it.)
|
8/6/2004 2:51:21 AM:
You want another star? you got it... :P I really like it, and the other 3d tutorials didn;t even mentioned directX they let me made my own (so i couldnt get it right :( :P TY matt (If this comment was disrespectful, please report it.)
|
8/6/2004 3:14:17 AM:
Hej but I have 1 question ofcourse it workes fine with your variabels, is there a site wich variables like D3DRMTEXTURE_NEAREST are even further explained, en wich more you can use instead? (ty) (If this comment was disrespectful, please report it.)
|
8/24/2004 5:51:06 AM: Michael Vainshtein
Man, i looked at so much tutorials.. understood nothing! you helped me SOO much! 10x 1 question that is bothering me: I wanna know the current position of a frame. so i do: dim PosVec As D3DVECTOR FR_Building.GetPosition (FR_Building,PosVec) X=posVec.X --returns automation error on line with the function FR_Building.GetPosition (nothing,PosVec) returns 0 ALL the time.. if some1 knows how 2 correct plz mail me mishasoft@hotmail.com, or post here
10q for the submittion!!!! (If this comment was disrespectful, please report it.)
|
8/24/2004 5:53:47 AM: Michael Vainshtein
OK OK sorry for flooding.. i got it working again 10x for the project!!! (If this comment was disrespectful, please report it.)
|
5/18/2005 5:07:17 PM:
im just getting started in the direct3d world so i really hope this can help me out from wat ive read about this tutorial it sounds really great thanks and good luck on the flight simulator (If this comment was disrespectful, please report it.)
|
6/20/2005 7:50:51 PM: Miles Cloud
Direct X can be a crybaby when it comes to graphics. It's really hardware sensitive, so if it doesn't work when you initialize it, try setting it to lower resolution & screen depth. (If this comment was disrespectful, please report it.)
|
11/23/2005 7:33:55 PM:
this is helpful thanks (If this comment was disrespectful, please report it.)
|
12/27/2005 10:30:29 AM: Danilo Ramos
Well this is not my first tutorial i already have a lot of them but this one is really good, dont have a nice game or nice unfinished game but explain every var and every object that you will need to start lerning Directx every line of code is commented so is really helpful thks for this lesson hehehe when i finish this tutorial ill be able to modify some samples os games in VB that i already have here :)(you have my vote) (If this comment was disrespectful, please report it.)
|
2/10/2007 9:34:36 AM: gVeR
very good work ,gratz (If this comment was disrespectful, please report it.)
|
2/25/2007 4:20:42 PM: Don Gholson
DirectX Info (If this comment was disrespectful, please report it.)
|
6/21/2008 9:24:00 AM: jigs
nice
(If this comment was disrespectful, please report it.)
|
11/11/2009 12:36:37 PM: Khan
Hello , i am new to vb and i want to make an aircraft model simple one and than controlling the Pitch , Roll and Yaw moments , and other stuff to , i can control the aircraft. Is it possible to do so ??? Please help (If this comment was disrespectful, please report it.)
|
Add Your Feedback
Your feedback will be posted below and an email sent to
the author. Please remember that the author was kind enough to
share this with you, so any criticisms must be stated politely, or they
will be deleted. (For feedback not related to this particular article, please
click here instead.)
To post feedback, first please login.
|