DirectX 10 Tutorials

can i have some links?

Page 1 of 1

4 Replies - 7271 Views - Last Post: 08 October 2009 - 04:39 PM Rate Topic: -----

#1 athlon32  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 117
  • View blog
  • Posts: 363
  • Joined: 20-August 08

DirectX 10 Tutorials

Posted 06 October 2009 - 05:24 PM

Ok, i know a little DirectX 9, (i can do the basics in Direct3D, and some DirectInput, etc), but i really wanna learn DirectX 10. I got the latest version of the SDK, but i can't seem to find any tutorials...at least not free ones...and i really don't wanna buy a book; thus i came to the experts :D

hope you can help me :D

Is This A Good Question/Topic? 0
  • +

Replies To: DirectX 10 Tutorials

#2 magius96  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 75
  • View blog
  • Posts: 834
  • Joined: 15-April 09

Re: DirectX 10 Tutorials

Posted 07 October 2009 - 06:22 AM

Absolutely. Here's all the link you'll really ever need:

The Ultimate DirectX 10 Reference

As for not finding free ones...what keywords are you searching for? I can't seem to find paid tutorials.

This post has been edited by magius96: 07 October 2009 - 06:24 AM

Was This Post Helpful? 0
  • +
  • -

#3 athlon32  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 117
  • View blog
  • Posts: 363
  • Joined: 20-August 08

Re: DirectX 10 Tutorials

Posted 07 October 2009 - 02:49 PM

Thanks for the link :D

as for paid tutorials, i was talking about directxtutorial.com, and a few others

also, is DirectX 10 supposed to be slower than 9? I mean, I've run a few examples, and they take several seconds longer than DirectX 9 :?
Was This Post Helpful? 0
  • +
  • -

#4 magius96  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 75
  • View blog
  • Posts: 834
  • Joined: 15-April 09

Re: DirectX 10 Tutorials

Posted 08 October 2009 - 01:03 PM

I'm not entirely sure about the speed differences, as I haven't really tested the two out on the same machine, but it's my understanding that dx10 is supposed to be more optimized than dx9 and therefor run faster and smoother. Of course since dx is a library to be used with code you write, I guess it all comes down to how you write your code, and in what language you write it.
Was This Post Helpful? 0
  • +
  • -

#5 athlon32  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 117
  • View blog
  • Posts: 363
  • Joined: 20-August 08

Re: DirectX 10 Tutorials

Posted 08 October 2009 - 04:39 PM

OK, well this is an example of what i compiled (i got it from here: http://wiki.directxe...ct3D_10_Device)

  #include "windows.h"
  #include "d3d10.h"

  bool g_bContinue = true;

  //Besides the main function, there must be a message processing function
  LRESULT WINAPI MsgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
  {
      switch( msg )
      {
       case WM_DESTROY:
          PostQuitMessage( 0 );
          g_bContinue = false;
          return 0;
      }
      return DefWindowProc( hWnd, msg, wParam, lParam );
  }

  //The entry point of a windows application is the WinMain function
  INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR, INT )
  {
      //Create a window class.
      WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, MsgProc, 0L, 0L, 
                        GetModuleHandle(NULL), NULL, NULL, NULL, NULL,
                        "Direct3D Window", NULL };
      //Register the window class.
      RegisterClassEx( &wc );
      //Create the application's window.
      HWND hWnd = CreateWindow( "Direct3D Window", "DirectX Wiki - D3D10 Tutorial 1", 
                                WS_OVERLAPPEDWINDOW, 100, 100, 400, 400,
                                GetDesktopWindow(), NULL, wc.hInstance, NULL );

      ShowWindow(hWnd,SW_SHOW);

      //Create the Direct3D Device and Swap Chain
      DXGI_SWAP_CHAIN_DESC sd;
      ZeroMemory( &sd, sizeof(sd) );
      sd.BufferCount = 1;
      sd.BufferDesc.Width = 640;
      sd.BufferDesc.Height = 480;
      sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
      sd.BufferDesc.RefreshRate.Numerator = 60;
      sd.BufferDesc.RefreshRate.Denominator = 1;
      sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
      sd.OutputWindow = hWnd;
      sd.SampleDesc.Count = 1;
      sd.SampleDesc.Quality = 0;
      sd.Windowed = TRUE;

      IDXGISwapChain* pSwapChain = NULL;
      ID3D10Device* pd3dDevice = NULL;
      if( FAILED( D3D10CreateDeviceAndSwapChain( NULL, 
                                               D3D10_DRIVER_TYPE_REFERENCE, 
                                               NULL,
                                               0,
                                               D3D10_SDK_VERSION, 
                                               &sd,
                                               &pSwapChain,
                                               &pd3dDevice ) ) )
      {
          return FALSE;
      }

      // Create a render target view(from Backbuffer)
      ID3D10Texture2D *pBackBuffer = NULL;
      ID3D10RenderTargetView *pRenderTargetView = NULL;
      if( FAILED( pSwapChain->GetBuffer( 0, __uuidof( ID3D10Texture2D ), (LPVOID*)&pBackBuffer ) ) )
          return FALSE;
      HRESULT hr = pd3dDevice->CreateRenderTargetView( pBackBuffer, NULL, &pRenderTargetView );
      pBackBuffer->Release();
      if( FAILED( hr ) )
          return FALSE;
      pd3dDevice->OMSetRenderTargets( 1, &pRenderTargetView, NULL );

      //In D3D10 this must be done, because there is no default Viewport
      D3D10_VIEWPORT vp;
      vp.Width = 640;
      vp.Height = 480;
      vp.MinDepth = 0.0f;
      vp.MaxDepth = 1.0f;
      vp.TopLeftX = 0;
      vp.TopLeftY = 0;
      pd3dDevice->RSSetViewports( 1, &vp );

      MSG msg; 
      while( g_bContinue )
      {
          //Clear render region with blue
          float ClearColor[4] = { 0.0f, 0.0f, 1.0f, 1.0f }; //red,green,blue,alpha
          pd3dDevice->ClearRenderTargetView( pRenderTargetView, ClearColor );
   
          pSwapChain->Present( 0, 0 );

          // A window has to handle its messages.
          TranslateMessage( &msg );
          DispatchMessage( &msg );
          PeekMessage(&msg, 0, 0, 0, PM_REMOVE);
      }
      
      //Do not forget to clean up here
      pSwapChain->Release();
      pSwapChain = NULL;
      pRenderTargetView->Release();
      pRenderTargetView = NULL;
      pd3dDevice->Release();
      pd3dDevice = NULL;

      return 0;
  }



Basically when i run that, it takes about 3-5 seconds to work, and i messed around with it, to no avail

hope ya can help :D
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1