Direct3D Can' Create Device?

This is a discussion on Direct3D Can' Create Device? within the Game Programming forums, part of the General Programming Boards category; I downloaded the DirectX 8 development documents and I was trying to create my first Direct3D program. I created a ...

  1. #1
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Question Direct3D Can' Create Device?

    I downloaded the DirectX 8 development documents and I was trying to create my first Direct3D program. I created a window. Then, I tried to initialize Direct3D. Everything works until I use the CreateDevice() Function. It pops up with my error message, and says something like DIRECT3D_INVALIDCALL. Can someone help me? I did exactly what is in the docs. I have DirectX 8.01 on my computer. It's a PII, 128MB RAM, Windows 98 computer. I even tried it on a computer that has an nVidia card.

    Thanks,
    Matt U.
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: trifaze_mattu@lycos.com

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    If you posted your init code I might be able to help you.

  3. #3
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Lightbulb Okay...

    Okay, sorry. Here it is:

    Code:
    // This Function Initializes D3D
    int D3D_Init (HWND hwnd, IDirect3DDevice8* d3d_dev, LPDIRECT3D8 d3d8, D3DDISPLAYMODE disp, D3DPRESENT_PARAMETERS dpp)
    {
      if (NULL == (d3d8 = Direct3DCreate8 (D3D_SDK_VERSION)))
        return -1;
    
      if (FAILED (d3d8->GetAdapterDisplayMode (D3DADAPTER_DEFAULT, &disp)))
        return -2;
    
      ZeroMemory (&dpp, sizeof (dpp));
      dpp.Windowed           = TRUE;
      dpp.hDeviceWindow      = hwnd;
      dpp.SwapEffect         = D3DSWAPEFFECT_DISCARD;
      dpp.BackBufferFormat   = disp.Format;
    
      if (FAILED (d3d8->CreateDevice (D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd,
                                      D3DCREATE_SOFTWARE_VERTEXPROCESSING,
                                      &dpp, &d3d_dev)))
        return -3;
    }
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: trifaze_mattu@lycos.com

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  4. #4
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    I don't have this line in my code.

    dpp.hDeviceWindow = hwnd;

    You already pass it to the function (CreateDevice). Also I assume prior to calling this function you fill in D3DDISPLAYMODE settings with GetAdapterMode( ) .

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to create a file association program?
    By eShain in forum Windows Programming
    Replies: 1
    Last Post: 03-06-2006, 11:15 AM
  2. Cannot create MDI Client Win
    By JaWiB in forum Windows Programming
    Replies: 1
    Last Post: 10-31-2005, 09:05 PM
  3. Linux (2.6.10+) device driver: multiple classes?
    By filker0 in forum Linux Programming
    Replies: 3
    Last Post: 09-26-2005, 08:46 PM
  4. Modem in Linux need help fast please!
    By xxxrugby in forum Tech Board
    Replies: 0
    Last Post: 03-30-2005, 03:10 PM
  5. Replies: 4
    Last Post: 06-30-2004, 03:11 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21