Note that there are some explanatory texts on larger screens.

plurals
  1. PODirectX10 swapchain and device point to 0x00000000 (causing runtime error) (c++)
    primarykey
    data
    text
    <p>Ok, i followed <a href="http://www.directxtutorial.com/Tutorial10/B-Direct3DBasics/dx10B1.aspx" rel="nofollow">this tutorial</a> (code is down below on the page, just top of the picture you can click on show code) about DX10 and c++ basically the code is like</p> <pre><code>// include and stuff ID3D10Device* device; // adding = NULL wont change problem ID3D10RenderTargetView* rtv; IDXGISwapChain* swapchain; // function predecs, winmain, winproc // winmain calls initD3D(hWnd) just before entering msg loop void initD3D(HWND hWnd){ DXGI_SWAP_CHAIN_DESC scd; // creates struct for swap chain info ZeroMemory(&amp;scd, sizeof(DXGI_SWAP_CHAIN_DESC)); // clear the struct for use scd.BufferCount = 1; // create two buffers one front buffer one back buffer scd.BufferDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; // use 32-bit color scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; // tell how chain is to be used scd.OutputWindow = hWnd; // set window to be used by d3d scd.SampleDesc.Count = 1; // set level of multi sampling scd.SampleDesc.Quality = 0; // set quality of multisampling scd.Windowed = true; // set to windowed or fullscreen D3D10CreateDeviceAndSwapChain(NULL, D3D10_DRIVER_TYPE_HARDWARE, NULL, 0, D3D10_SDK_VERSION, &amp;scd, &amp;swapchain, &amp;device); // get the adress of the backbuffer and use it to create the render target ID3D10Texture2D* pBackBuffer; // AND HERE (NEXT LINE) THE ERROR OCCURS swapchain-&gt;GetBuffer(0, __uuidof(ID3D10Texture2D), (LPVOID*)&amp;pBackBuffer); // on runtime debugger tells me swapchain value is 0x00000000 // why does it point to nowhere? device-&gt;CreateRenderTargetView(pBackBuffer, NULL, &amp;rtv); pBackBuffer-&gt;Release(); // set the render target as the back buffer device-&gt;OMSetRenderTargets(1, &amp;rtv, NULL); D3D10_VIEWPORT viewport; // create a struct to hold the viewport data ZeroMemory(&amp;viewport, sizeof(D3D10_VIEWPORT)); // clear the struct //viewport.stuff device-&gt;RSSetViewports(1, &amp;viewport); //set the viewport </code></pre> <p>}</p> <p>i left out the unnecessary code, I think you can either figure it out or follow the link if you really need the full code, I want to focus on the main problem ;)</p> <p>so as stated in the code my debugger tells me that <code>swapchain</code> points to 0x00000000 looking through the values i found out that its the same with <code>device</code> also poinmts to 0x00000000. Message is: </p> <pre><code>First-chance exception at 0x........ in bla.exe: 0x........: Access violation reading location 0x00000000 </code></pre> <p>i looked over the whole code, have no idea what might be the problem.</p> <p>could it be a hardware related problem? I am on a Thinkpad T510 with two graphics chips (one intel and one nVidia), using the nVidia chips as default causes Visual Studio to crash.</p> <p>i have no idea what else might be the problem, because the tutorial states that the code will run :) i know that there is another topic with a very very related problem, but as far as i understand its not the same. (and the answer the author gave himself doesn't solve my problem)</p> <p>edit: i just read debug output and it seems that a <em>*</em>*load of *.dlls couldn't be loaded btw I am using the x86 libs of DX SDK</p> <p>snippet:</p> <pre><code>'AnotherWindowsApp.exe': Loaded 'E:\visual studio 2010 Projects\AnotherWindowsApp\Debug\AnotherWindowsApp.exe', Symbols loaded. 'AnotherWindowsApp.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file 'AnotherWindowsApp.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file 'AnotherWindowsApp.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file [...] 'AnotherWindowsApp.exe': Loaded 'C:\Windows\SysWOW64\nvinit.dll', Binary was not built with debug information. 'AnotherWindowsApp.exe': Loaded 'C:\Program Files (x86)\NVIDIA Corporation\coprocmanager\detoured.dll', Cannot find or open the PDB file 'AnotherWindowsApp.exe': Loaded 'C:\Program Files (x86)\NVIDIA Corporation\coprocmanager\Nvd3d9wrap.dll', Cannot find or open the PDB file [...] 'AnotherWindowsApp.exe': Loaded 'C:\Windows\SysWOW64\d3d9.dll', Cannot find or open the PDB file 'AnotherWindowsApp.exe': Loaded 'C:\Program Files (x86)\NVIDIA Corporation\coprocmanager\nvdxgiwrap.dll', Cannot find or open the PDB file 'AnotherWindowsApp.exe': Loaded 'C:\Windows\SysWOW64\d3d11.dll', Cannot find or open the PDB file [...] 'AnotherWindowsApp.exe': Loaded 'C:\Windows\SysWOW64\igd10umd32.dll', Cannot find or open the PDB file First-chance exception at 0x7623b727 in AnotherWindowsApp.exe: Microsoft C++ exception: _com_error at memory location 0x0045f06c.. First-chance exception at 0x7623b727 in AnotherWindowsApp.exe: Microsoft C++ exception: _com_error at memory location 0x0045ef90.. First-chance exception at 0x7623b727 in AnotherWindowsApp.exe: Microsoft C++ exception: _com_error at memory location 0x0045f0e0.. The thread 'Win32 Thread' (0x18b0) has exited with code 0 (0x0). The thread 'Win32 Thread' (0x12dc) has exited with code 0 (0x0). The thread 'Win32 Thread' (0x354) has exited with code 0 (0x0). The thread 'UMDShimPresentThread' (0x1080) has exited with code 0 (0x0). 'AnotherWindowsApp.exe': Unloaded 'C:\Windows\SysWOW64\nvwgf2um.dll' 'AnotherWindowsApp.exe': Unloaded 'C:\Windows\SysWOW64\igd10umd32.dll' First-chance exception at 0x01281758 in AnotherWindowsApp.exe: 0xC0000005: Access violation reading location 0x00000000. Unhandled exception at 0x01281758 in AnotherWindowsApp.exe: 0xC0000005: Access violation reading location 0x00000000. First-chance exception at 0x01281758 in AnotherWindowsApp.exe: 0xC0000005: Access violation reading location 0x00000000. Unhandled exception at 0x01281758 in AnotherWindowsApp.exe: 0xC0000005: Access violation reading location 0x00000000. The program '[5912] AnotherWindowsApp.exe: Native' has exited with code -1073741819 (0xc0000005). </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload