WILL,tutorial,teach,started,with,using,Direct
Quick Search for:  in language:    
WILL,tutorial,teach,started,with,using,Direct
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
RentACoder Stats

 Code:  lines
 Jobs: 0 postings

 
Sponsored by:

 

You are in:

 
Login



Latest Code Ticker for RentACoder.
Click here to see a screenshot of this code!Snake II progress report
By Fi3k1 on 10/19

(Screen Shot)

Click here to see a screenshot of this code!Connector Line with Arrow
By Senthamil on 10/19

(Screen Shot)

Click here to see a screenshot of this code!ICQ SMS Activex Component (Updated 19th October 2002)
By Vijay Bhatter on 10/19

(Screen Shot)

List
By xx AL xx on 10/19


Skilled Programmers needed
By xx AL xx on 10/19


Elite Frogger
By hellam on 10/18


Odometer type counter
By Kenneth Foster on 10/18


Click here to see a screenshot of this code!VBLayers ActiveX Control
By Joseph M. Ferris on 10/18

(Screen Shot)

CoolPlayer *ID3 fixed...
By Giannis_B on 10/18


Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!





Affiliate Sites



 
 
   

DXTUT4 - Introduction to Direct3D!

Print
Email
 

Submitted on: 11/1/2000 1:43:40 PM
By: Simon Price  
Level: Intermediate
User Rating: By 30 Users
Compatibility:

Users have accessed this article 18381 times.
 
(About the author)
 
     <p>This tutorial <b> WILL</b> teach you how to get started with using <font color="#FF0000"> Direct3D Immediate Mode from Visual Basic</font>. It includes background knowledge, definitions, explanations, a sample program to download, and exercises for you to practice on. I have spent hours, wrong, days planning, writing, testing and re-reading this so that it's almost a work of art. Seriously though, you will learn alot. I recommend a very basic knowledge of DirectDraw, but this is not required, and a fairly good general programming ability, since only DirectX terms will be explained in detail. If you think that this has helped you, interested you, or changed your whole life (OK maybe not), <font color="#FF0000">please vote and/or give feedback because I value your opinions</font>. Especially if you think this was a bad tutorial, please tell me why and I will try to fix it.</p>

This article has accompanying files
 
 
Terms of Agreement:   
By using this article, you agree to the following terms...   
1) 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.   
2) 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.   
3) You may link to this article from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.

An Introduction To Direct3D

By Simon Price

Tutorial Breakdown

This tutorial will consist of the following steps :

  • Explanation of what Direct3D does and how you can use it from Visual Basic

  • Definitions of all the objects, types and enumerations you will need to know to get started

  • Example source code with heavy commenting

  • Summary of what you have learnt

  • Exercises to make you remember it all

Direct3D Overview

Direct3D is a part of DirectX. This tutorial is specific to Direct3D 7, so you will need DirectX 7.0 or higher if you are planning to use what you learn here. DirectX has a component called DirectDraw, which is used to perform graphics functions at a lower level that Windows GDI. If you have never used DirectDraw before, I suggest you look at my tutorial "An Introduction To DirectDraw", available on this site, or my website. Direct3D (D3D) has two main parts - Immediate Mode and Retained Mode. This tutorial deals with Immediate Mode only. Immediate Mode (IM) is built on top of DirectDraw. That means it uses DirectDraw to place graphics on the screen, or in memory. D3D Retained Mode (RM) is built on top of D3D IM. Therefore, D3D RM is not as efficient as D3D IM. This is why I have chosen to learn D3D IM. However, I do not claim that one is better than the other, just that IM is faster and RM is easier to learn and create applications very quickly with. If you learn IM, heavy vector mathematics and slow development is involved but you will be rewarded with more power and control. The choice is yours. If you still want to learn IM, then read on.

Direct3D has a job - to give programmers a common interface for all 3D devices. In English - no matter what computer your application runs on, whether it has a Voodoo Mega Wicked 10000 3D accelerator or a Omega Budget 256 Color Economy VGA card, you still use the same objects to program with. It means that you don't have to learn about how every graphics card works for your application to work on every computer. Direct3D also provides software emulation. This means that if half your users have hardware acceleration, and half don't, you can use hardware if available and then fall back to using Direct3D software emulation if the hardware is not available. Of course software emulation is alot slower.

It's time to start Visual Basic! Create a new project and called it something imaginative like "D3Dintro.vbp". Next, click Project -> References and a dialog box will show a list of references your project uses. If you have installed the DirectX7 For Visual Basic type library, scroll down to it and check the check box next to it. Click OK to add the reference. Now Visual Basic knows every single class, type and enumeration you need to use DirectX7. If you do not have the DirectX 7 For Visual Basic Type Library, you can download it from www.microsoft.com .

Get on with the programming!

Here are the declarations you will need for the tutorial programs, with a short explanation as to what they are all about. First the objects followed by the types.

  • DirectX7 - this is the great big daddy of them all! It is from the DirectX7 object that you will create all the other objects, including DirectDraw and Direct3D. Note the use of the New keyword, meaning that your application puts aside the memory to create a new instance of this object.

Dim DX As New DirectX7
  • DirectDraw7 - this is the base of all the graphics functionality that DirectX provides, including Direct3D7. Note the omission of the New keyword, since you do not create this object, but DirectX does.

Dim DDRAW As DirectDraw7
  • DirectDrawSurface7 - this is an object created by DirectDraw to represent a piece of memory. You will need a primary and backbuffer surface. The primary surface represents the actual graphics on the screen, the backbuffer is a surface to draw our whole image onto before we copy it to the primary surface.

Dim Primary As DirectDrawSurface7
Dim Backbuffer As DirectDrawSurface7
  • DirectDrawClipper - this is used to clip areas, meaning that if you try draw outside the clipping boundaries, nothing will be drawn. This is useful in Windows so that you don't make a mess all over bits of screen that don't belong to your application.

Dim Clipper As DirectDrawClipper
  • Direct3D7 - this is based upon DirectDraw. It provides all the 3D functionality you will need.

Dim D3D As Direct3D7
  • Direct3DDevice7 - this is the rendering device. You use it to control the states and parameters of Direct3D, and to send drawing commands to draw (usually) triangles.

Dim D3Ddevice As Direct3DDevice7
  • RECT - this describes a rectangle, and DirectDraw uses it to copy rectangular pieces of pictures around. Here we need two, they are just cached for regular use in the program.

Dim SrcRect As RECT
Dim DestRect As RECT
  • D3DRECT - this is similar to the RECT type used with DirectDraw. We will use it in clearing operations. You will always need to declare it as an array, even if you only need one of them.

Dim Viewport(0) As D3DRECT
  • DDSURFACEDESC2 - this describes a DirectDrawSurface, so we can ask DirectDraw to create a surface with the properties we need.

Dim SurfDesc as DDSURFACEDESC2
  • D3DVIEWPORT7 - this describes the way in which Direct3D transforms a 3D scene to represent it on a 2D surface.

Dim VPdesc As D3DVIEWPORT7
  • D3DVERTEX - this type holds all the information we need to create a vertex. We are going to create a triangle so we need an array of 3.

Dim Vertex(0 to 2) as D3DVERTEX
  • D3DMATRIX - this holds 16 values which are used for any and every translation in 3D. With a matrix, you can translate, rotate and scale. We will need four in this tutorial, the world, view, projection and spin matrices.

Dim matWorld As D3DMATRIX
    Dim matView As D3DMATRIX
    Dim matProj As D3DMATRIX
    Dim matSpin As D3DMATRIX

You will also need to declare two other variables:

' this tells the program when to end
    Dim EndNow As Boolean
    ' this is used to rotate the triangle
    Dim Counter As Long
    

Initiation of DirectDraw and Direct3D

Now we have declared all the objects we need, we need to call some of their methods to make them do something. We will also use the variables to send information to DirectX. Since Direct3D is built upon DirectDraw, we will need to initialize the DirectDraw objects before Direct3D.

The DirectDrawInit Function

We will create a function that creates the DirectDraw object, sets the cooperative level, sets up the primary and backbuffer surfaces for our graphics functions to work on, and finally creates a clipper to restrict drawing to just the application window. Note then when we create the backbuffer surface, we pass the DDSCAPS_3DDEVICE flag to tell DirectDraw that we are going to use it as a 3D rendering target.

Function DirectDrawInit() As Long
    ' create the directdraw object
    Set DDRAW = DX.DirectDrawCreate("")
    ' set the cooperative level, we only need normal
    DDRAW.SetCooperativeLevel hWnd, DDSCL_NORMAL
    ' set the properties of the primary surface
    SurfDesc.lFlags = DDSD_CAPS
    SurfDesc.ddsCaps.lCaps = DDSCAPS_PRIMARYSURFACE
    ' create the primary surface
    Set Primary = DDRAW.CreateSurface(SurfDesc)
    ' set up the backbuffer surface (which will be where we render the 3D view)
    SurfDesc.lFlags = DDSD_HEIGHT Or DDSD_WIDTH Or DDSD_CAPS
    SurfDesc.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN Or DDSCAPS_3DDEVICE
    ' use the size of the form to determine the size of the render target
    ' and viewport rectangle
    DX.GetWindowRect hWnd, DestRect
    ' set the dimensions of the surface description
    SurfDesc.lWidth = DestRect.Right - DestRect.Left
    SurfDesc.lHeight = DestRect.Bottom - DestRect.Top
    ' create the backbuffer surface
    Set Backbuffer = DDRAW.CreateSurface(SurfDesc)
    ' cache the size of the render target for later use
    With SrcRect
    .Left = 0: .Top = 0
    .Bottom = SurfDesc.lHeight
    .Right = SurfDesc.lWidth
    End With
    ' create a DirectDrawClipper and attach it to the primary surface.
    Set Clipper = DDRAW.CreateClipper(0)
    Clipper.SetHWnd hWnd
    Primary.SetClipper Clipper
    ' report any errors
    DirectDrawInit = Err.Number
    End Function
    

The Direct3DInit Function

Now we need to initialize all our Direct3D objects. In this function, we need to create Direct3D, a rendering device (something that does the drawing for us), a material (defines the appearance of polygons), and several matrices. The rendering device can be some hardware device like a 3D accelerator card, or software emulation. For this tutorial, we will use software emulation for simplicity. The matrices are :

  • The world matrix - all objects in world space are transformed by this matrix

  • The view matrix - sets the position of the camera

  • The projection matrix - defines how Direct3D projects the 3D scene onto the 2D surface

Function Direct3DInit() As Long
    ' create the direct3d object
    Set D3D = DDRAW.GetDirect3D
    ' create the rendering device - we are using software emulation only
    Set D3Ddevice = D3D.CreateDevice("IID_IDirect3DRGBDevice", Backbuffer)
    ' set the viewport rectangle.
    VPdesc.lWidth = DestRect.Right - DestRect.Left
    VPdesc.lHeight = DestRect.Bottom - DestRect.Top
    VPdesc.minz = 0
    VPdesc.maxz = 1
    D3Ddevice.SetViewport VPdesc
    ' cache the viewport rectangle for later use
    With Viewport(0)
    .X1 = 0: .Y1 = 0
    .X2 = VPdesc.lWidth
    .Y2 = VPdesc.lHeight
    End With
    ' enable ambient lighting
    D3Ddevice.SetRenderState D3DRENDERSTATE_AMBIENT, DX.CreateColorRGBA(1, 1, 1, 1)
    ' disable culling
    D3Ddevice.SetRenderState D3DRENDERSTATE_CULLMODE, D3DCULL_NONE
    ' set the material to a red color
    Material.Ambient.r = 1
    Material.Ambient.g = 0
    Material.Ambient.b = 0
    D3Ddevice.SetMaterial Material
    ' the world matrix - all polygons in world space are transformed by this matrix
    DX.IdentityMatrix matWorld
    D3Ddevice.SetTransform D3DTRANSFORMSTATE_WORLD, matWorld
    ' the view matrix - basically the camera position is at -3
    ' (although it's really just making the whole world at +3)
    DX.IdentityMatrix matView
    DX.ViewMatrix matView, MakeVector(0, 0, -3), MakeVector(0, 0, 0), MakeVector(0, 1, 0), 0
    D3Ddevice.SetTransform D3DTRANSFORMSTATE_VIEW, matView
    ' the projection matrix - decides how the 3D scene is projected onto the 2D surface
    DX.IdentityMatrix matProj
    DX.ProjectionMatrix matProj, 1, 1000, 3.14 / 2
    D3Ddevice.SetTransform D3DTRANSFORMSTATE_PROJECTION, matProj
    ' report errors
    Direct3DInit = Err.Number
    End Function
    

The MakeVector Function

If you're still alert and haven't become totally confused yet, you will be saying "hey Simon, you called a MakeVector function - what's that all about? The MakeVector function is very similar to the DX.CreateD3DVertex (see later) function - it just saves us alot of typing by copying values into the D3DVECTOR type. So we need to create the MakeVector function for the Direct3DInit function to work.

Function MakeVector(x As Single, y As Single, z As Single) As D3DVECTOR
    ' copy x, y and z into the return value
    With MakeVector
    .x = x
    .y = y
    .z = z
    End With
    End Function

Creating The Scene

We need to supply triangles for Direct3D to render. Therefore we should declare some vertices to make the triangle from. For simplicity, we will render just one triangle which means we need only 3 vertices (one for each corner). We could fill in the data separately for each field of the type D3DVERTEX, but it's much shorter to use a function of the DirectX object that does this for you in one line of code.

The CreateTriangle Sub

This procedure takes the already declare vertices and forms them into a triangle shape. In a D3DVERTEX, there are three pieces of data - the position (x,y,z), the normal (nx,ny,nz) and the texture coordinates (tu,tv). We only need to use the position in this tutorial. The normal of a triangle is concerned with lighting, which we aren't using. The texture coordinates are for, well, textures - which we aren't using either.

Sub CreateTriangle()
    ' fill in the vertex positions - we don't need to worry about the normals
    ' or texture coordinates for this tutorial
    DX.CreateD3DVertex -1, 0, 0, 0, 0, 0, 0, 0, Vertex(0)
    DX.CreateD3DVertex 0, 2, 0, 0, 0, 0, 0, 0, Vertex(1)
    DX.CreateD3DVertex 1, 0, 0, 0, 0, 0, 0, 0, Vertex(2)
    End Sub
    

The Main Program Loop

OK that's enough loading and initializing to last me a lifetime! But once you've learnt it, it will get easier and you can always reuse your code. Now we move onto the main program loop. This is a loop where we clear the backbuffer, draw the polygon, copy the backbuffer to the screen and then move the polygon before we draw the next frame. Don't be surprised if this loop runs at over 100 frames per second - after all, it's just one polygon. In a real world application, you may want to render thousands per frame. On with the show:

Sub MainLoop()
    Do While EndNow = False
    ' increase the counter
    Counter = Counter + 1
    ' clear the viewport with a green color
    D3Ddevice.Clear 1, Viewport(), D3DCLEAR_TARGET, vbGreen, 0, 0
    ' begin the scene, render the triangle, then end the scene
    D3Ddevice.BeginScene
    D3Ddevice.DrawPrimitive D3DPT_TRIANGLELIST, D3DFVF_VERTEX, Vertex(0), 3, D3DDP_DEFAULT
    D3Ddevice.EndScene
    ' rotate the matrix
    DX.RotateYMatrix matSpin, Counter / 360
    ' set the new world transform matrix
    D3Ddevice.SetTransform D3DTRANSFORMSTATE_WORLD, matSpin
    ' copy the backbuffer to the screen
    DX.GetWindowRect hWnd, DestRect
    Primary.Blt DestRect, Backbuffer, SrcRect, DDBLT_WAIT
    ' look for window messages - we need to know when the escape key is pressed
    DoEvents
    Loop
    End Sub
    

Getting It Together

If you run your program now, nowt will happen at all. This is because you have created a load of procedures but you haven't called them from anywhere. This is when you will need to put some code into the Form_Load event, to do initiation and then the main loop. We will check the return values of the initiation functions, and if they report errors we will end the program.

The Form_Load Event

Private Sub Form_Load()
    ' show the form
    Show
    ' call the DirectDrawInit function and exit if it fails
    If DirectDrawInit() <> DD_OK Then Unload Me
    ' call the Direct3DInit function and exit if it fails
    If Direct3DInit() <> DD_OK Then Unload Me
    ' create the triangle
    CreateTriangle
    ' call the main rendering loop
    MainLoop
    ' end the program
    Unload Me
    End Sub

The Form_Unload and Form_KeyDown Events

There is one more thing to do - end the program! The main loop is exited if the EndNow variable is set to true - so that's all we need to do. We can also end the program if the escape key is pressed, by putting the same code in the Form_KeyDown event.

Private Sub Form_Unload(Cancel As Integer)
    EndNow = True
    End Sub
    
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    ' end program if escape is pressed
    If KeyCode = vbKeyEscape Then EndNow = True
    End Sub
    

Run The Program

Run the program. If you've typed it correctly (or just used my example code), you will see the form has a spinning triangle painted on it. You can even resize the form and the picture will resize to the form size. When you close the form or press escape, the program ends.

Summary

In this tutorial, we have :

  • Learnt how to set up DirectDraw surfaces for Direct3D.
  • Set up Direct3D, telling it to render on a DirectDraw surface
  • Create a very basic geometric shape
  • Render a triangle and change the world matrix to move spin the world

There are many bad points to the program you have created, although I have made the program in this way to make it as simple as possible.

  • All the variables were global - in my opinion you should restrict access to each variable as much as possible. I made them all global for this tutorial so I could explain each one at the beginning
  • Very little error handling was done. In a real application, we would find the cause of the error, attempt to fix it, and if that's not possible we would tell the user why, rather than ending immediately.
  • We used software rendering only. What we should do is find out what sort of hardware the user has, and make our program adapt to either make maximum use of the hardware, or fall back onto just software if no hardware is available.
  • And I'm sure the critics amongst you will think of more.

Exercises

You can only learn something if you actually practice doing it. So here I have some features which you can add to the program yourself. Come on, be a little creative and start making your own 3D graphics!

  • That triangle is boring! It's even looks 2D! Use more vertices to make another shape - a cube, a pyramid, a sphere if you're smart enough - whatever you like!
  • Make a frame counter, so that you know how fast the program is running. I bet it goes at over 100 FPS!
  • Change the colors to something you like.
  • Explore more Direct3D functions, meddle with the code, make it your program. I don't want here any complaints that this tutorial was boring - it's up to you to make it interesting!

I hope I've set you along the exciting journey towards creating Direct3D graphics from Visual Basic. This tutorial has taken me ALOT of time and effort - I had to write code, make comments, write a tutorial, get it as accurate as possible. I would appreciate in return:

  • Please vote for me - Whether you think this tutorial was good or bad, I want to know about it.
  • Please give me some feedback - Tell me why you voted the score that you did.
  • Please visit my website - If you liked this then you'll want to visit my website to see more of my programs and tutorials. The URL is www.VBgames.co.uk
  • Please give me $30000 to write a book - OK only joking.

Tutorial by Simon Price, you can email me at Si@VBgames.co.uk

Back To Top

winzip iconDownload 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 Winzipto 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:
1)Re-scan downloaded files using your personal virus checker before using it.
2)NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

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...   
1) 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.   
2) 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.   
3) You may link to this article from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.


Other 17 submission(s) by this author

 

 
Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this article(in the Intermediate category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
11/1/2000 1:49:31 PM:Simon Price
Don't forget to download the sample program!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/1/2000 4:20:22 PM:Luiz L Cruz
Simon, thanks a lot for this tutorial! It's Execellent, and it deserved a five from me. I downloaded the DirectX SDK, but it's way too long. With this simple tutorial I was able to learn a lot more than what I learned from reading that boring, lengthy documentation. Hey, one question, did you read those SDK docs? How did you learn Directx?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/1/2000 4:42:42 PM:Simon Price
Yep, the SDK docs, even if a little boring, have taught me enough to write this tutorial. I reckon the docs are the best way to learn, but so many people told me they're not so I wrote this tutorial. I'm glad it helped you. And thanks for the votes, please keep them coming in!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/2/2000 4:41:45 AM:Nathan Chere
As much as I hate jumping on the proverbial band-wagon, I'll give you a 5 too. On the side, your web site REALLY needs some work. If you put as much effort into that as you did your VB it would rule.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/2/2000 4:43:47 AM:Nathan Chere
Also, interesting how you chose to wait until the next month for your next submission... I'm guessing if you get two Code-Of-The-Month's in the one month you get two prizes, so no reason to drag it out. No more SESoftware jokes too, you've earned your praise.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/2/2000 1:22:39 PM:Simon Price
Nathan, thanks for the vote, I didn't simply choose to "wait" until the next month to make this, I only just finished this tutorial recently. I'm not after prizes, since I still have 3 unclaimed code of the month prizes... and also, I doubt I can win last months code of the month with my lame 3d viewer. Although the 3d viewer is alot better now, I'm not allowed to release the source because someone bought the rights to the code. And if you have any suggestions as to how I should improve my website, please tell me. Thanks.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/2/2000 1:23:59 PM:Tim
Very good but is there going to be a part two? It covers many things but still there is more to cover....mind you at the rate MS is going one could go on for ever.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/2/2000 3:50:03 PM:Simon Price
No promises for a part 2, (or actually 5, if you've been reading my tutorials from the start) but I'll try to fit it into my busy schedule...
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/3/2000 2:40:50 AM:Nathan Chere
I've had a bit more free time on my hands recently... I'd be happy to design a site for you if you want. VB's only a small hobby for me- my strength is graphics and design, so if you're interested let me know (ferretallica@planetferret.cjb.net). No charge etc, but I retain the rights to the graphics.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/3/2000 1:13:48 PM:Simon Price
Nathan, thanks for the offer but I'm happy with my website as it is now. Tim, I was only joking about the busy schedule.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/12/2000 10:23:56 AM:KOSTAS
WELL SIMON I HAVE ONLE EXCELLENT FOR YOU.I REALLY THINK YOU ARE A REAL MASTER OF 3D PROGRAMMING IN VB.I TRIED TO MAIL YOU MANY TIMES BUT I FAILED. I WOULD REALLY APRECIATE SOME HELP FROM YOU AND ALSO GIVE YOU GOOD GRAPHICS FOR YOUR PROJECTS. PLEASE MAIL ME kingdoom@internet.gr
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/12/2000 12:47:51 PM:Simon Price
Doh! DirectX 8.0 final release is out, better start learning all over again! Actually, I think I'll keep programming in DX 7 since it's backwards compatable, although DX 8 looks easier I'm already used to 7. What's every one else going to do I wonder?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/16/2000 6:15:05 PM:MangaMorgan
I take a different approch to directx programming (altho the basics would always be the same due to the setup of the directx api's), however, i did find your previous dx7 tutorials a great starting block! I'm looking forward to finding the time to work thro ur tutorial, and then creating my own spinning thing. At the end of the day, the best test of a programmer and the litriture that he refers to (in this case ur tutorial) is not wether he can copy your coding and change applicable variables to create a different coloured spinny thing, but using the reference as a guide to producing hes own brand new spinny thing. And my spinny thing will be just that. Thanks 4 finding the time to write me things to use up my time with :). o, and ur site is a little dull. but who can blame it? we r all working men of this world and somethings have to take prioraty over others!!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/17/2000 4:31:06 PM:Simon Price
MangaMorgen, I understand why you mean about how changing the variables in my program won't make you learn the whole of DirectX, but it's a very easy way to start and this really was designed for very beginners. A few people recently have told me my site is dull, because of a rise in the number of visitors there's also alot more feedback. I'll try to improve it, but I'm not that good with websites. Thanks for the pointers.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/4/2000 2:52:54 PM:Simon Price
Whopee! This won code of the month, thanks to the people who voted for me! It's a shame I can't get DX8 to install and get learning it. I also took your suggestions on improving my website. If anyone can help me install DX8, please do. Thanks!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/10/2000 2:42:59 PM:[[[
[iiiiii
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/16/2000 9:13:16 AM:Mark Withers
? - For some reason simon my direct x7 don't work with this code. But it is a very good tutorial. Heres a 5*
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/19/2000 3:18:55 PM:SniperBoB
I don't care what anyone says, those SDK docs suck for DX8! And even the tutorials are a little buggy! Only Microsoft could pull that off! HAHA. (I shouldn't talk, I don't own a multi-billion-dollar company) I can't wait until you get out a DX8 tutorial. I understand a lot has changed (everything got intergrated now) Good luck getting it installed... why don't you try www.microsoft.com 's help? Hehehehehe
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/20/2000 1:34:53 PM:DeathX
Hey, When I run it ?!?!? I get User Defined type not defined ? any suggestions?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/20/2000 1:47:26 PM:Simon Price
Mark - any more info so I can help you? SniperBob - Hey I got DX 8 installed and I hope to make another tutorial once I've spent a while learning it. Death X - could the reference to the DX VB type lib be missing?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/23/2000 6:03:23 AM:Niall Mooney
Simon your tutorials are good & even a little useful . Have 5 globes.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/11/2001 1:43:47 PM:Codin Geniuis
Very good tutorial.A bit beyoond me Im afraid. One tings though. Your triangle tutorial. It gives an error for me. I copied and pasted your code exactly but in the Direct3DInit procedure, the word material in the line, D3Ddevice.SetMaterial Material, gives an error: "Byref argument typemismatch". Its a compile error. Any ideas. E mail me if you know. Otherwize a very good tutorial. 5 Stars ;).
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/14/2001 3:42:52 PM:Nick Ridley
I copyed and pasted the code from the tutorial, it didnt work, but downloaded the code,and it did, you left out the Material variable on this tutorial. I made a FPS counter and it runs at around 3600 on a 1ghz machine with 128mb RAM in WinME not using my GeForce 2 nVida MX2 32mb
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/29/2001 2:56:27 PM:trudoggie
I soooo don't get this. Is there any other way to do 3D programming in vb besides directx?? Oh, and all the directx samples i've downloaded do not work. I always get an error that says
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/29/2001 2:59:28 PM:trudoggie
I just can't understand your tutorial. I haven't found ANY 3D vb tutorials that I COULD understand. Is there any other way to program 3D in vb w/o using directx?? Oh, and the code u have doesn't werk: it always gives me this error: "User-defined types and fixed-length strings not allowed as the type of a public member of an object module; private object modules not allowed as the type of a public member of a public object module" and it's a compile error and it highlights the line: Function MakeVector(x As Single, y As Single, z As Single) As D3DVECTOR
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/13/2002 8:11:24 PM:Matt Warr
Great stuff .. i worked out how to use this to make solid shapes ... amazing .... can someone help with lighting? so it can actually be lit to show it`s solid?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
4/1/2002 4:45:26 PM:Steven
Simon, you and your tutorials and programs never cease to amaze me. keep up the great work. 5 stars
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this article has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular article, please click here.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | RentACoder Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.