• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

100 Neutral

About sharksaw40

  • Rank
  1. D3D_DRIVER_TYPE_WARP does make it work so it must be a hardware problem. I re-installed the driver but it still didn't fix. Does anyone know what I could do to use the hardware? Thanks for the help.
  2. [color=#434343][font=helvetica, arial, verdana,]I am learning directx from [/font][/color][url="http://www.directxtutorial.com/"]directxtutorial.com[/url][color=#434343][font=helvetica, arial, verdana,] and when I have compiled one of the samples and run it then close it I get an error message saying "Unhandled exception at 0x010a1883 in test.exe: 0xC0000005: Access violation reading location 0x00000000.". What does this mean? I have checked that I have typed out all the code correctly and copied and pasted the sample into VC++ which still gives me the error. I think the function causing the problem is:[/font][/color] [CODE] void CleanD3D(void) { swapchain->Release(); dev->Release(); devcon->Release(); } [/CODE] There is a yellow arrow next to it (I'm a beginner and I'm not entirely sure what it means but I'm guessing it means there is an error on that line). I assume that the codes not the problem because I got it from a tutorial so it must be a configuration problem. Can someone tell help me find what could be wrong? The rest of the code is below: [code]#include <windows.h> #include <windowsx.h> #include <d3d11.h> #include <d3dx11.h> #include <d3dx10.h> #pragma comment (lib, "d3d11.lib") #pragma comment (lib, "d3dx11.lib") #pragma comment (lib, "d3dx10.lib")IDXGISwapChain *swapchain; ID3D11Device *dev; ID3D11DeviceContext *devcon; void InitD3D(HWND hWnd); void CleanD3D(void);LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { HWND hWnd;WNDCLASSEX wc; ZeroMemory(&wc, sizeof(WNDCLASSEX));wc.cbSize = sizeof(WNDCLASSEX); wc.style = CS_HREDRAW |CS_VREDRAW; wc.lpfnWndProc = WindowProc; wc.hInstance = hInstance; wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)COLOR_WINDOW; wc.lpszClassName = "WindowClass1"; RegisterClassEx(&wc);RECT wr = {0,0,800,600}; AdjustWindowRect(&wr, WS_OVERLAPPEDWINDOW, FALSE);hWnd = CreateWindowEx(NULL, "WindowClass1", "Our first windowed program", WS_OVERLAPPEDWINDOW, 300, 100, wr.right - wr.left, wr.bottom - wr.top, NULL, NULL, hInstance, NULL); ShowWindow(hWnd, nCmdShow);InitD3D(hWnd); MSG msg={0};while(TRUE) { if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); if(msg.message == WM_QUIT) break; } else { } } CleanD3D(); return msg.wParam; }LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wparam, LPARAM lparam) { switch(message) { case WM_DESTROY: { PostQuitMessage(0); return 0; } break; } return DefWindowProc(hWnd, message, wparam, lparam); }void InitD3D(HWND hWnd) { DXGI_SWAP_CHAIN_DESC scd; ZeroMemory(&scd, sizeof(DXGI_SWAP_CHAIN_DESC));scd.BufferCount = 1; scd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; scd.OutputWindow = hWnd; scd.SampleDesc.Count = 4; scd.Windowed = TRUE; D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, NULL, NULL, NULL, D3D11_SDK_VERSION, &scd, &swapchain, &dev, NULL, &devcon); }[color=#ff0000]void CleanD3D(void) { swapchain->Release(); dev->Release(); devcon->Release(); }[/color] [/code] Thanks in advance
  • Advertisement