The address of m_d3d is indeed 0xcccccccc, but I don't understand now, I did create it :S
I initialized it to 0 in the constructor initialization list, so the value was 0x00000000.
I get exactly the same error, just a different value:
Unhandled exception at 0x012b1764 in DXEngine.exe: 0xC0000005: Access violation reading location 0x00000000.
? You are setting a pointer to NULL and expecting to dereference it? Big mistake hehe. Post the creation code and preferrably snippet where the creation code gets called if it's a seperate function. Remember that if the creation code doesn't get called in the constructor then it should be called BEFORE you call a function that tries and use these pointers.
lol yeah, my bad, I think that I want to get this working so badly that i'm forgetting the basics :( although I fixed that error! I didn't create the device before I set the capabilities, silly me. But now I get another:
Originally Posted by valaris
Unhandled exception at 0x0014238a in DXEngine.exe: 0xC0000005: Access violation reading location 0xcccccccc.
bool DXGraphics::bDisplay() /*Function Definition*/
if(m_d3dDevice) /*If the object exists*/
m_d3dDevice->Clear(0, /*Number of rectangles in the following array...*/
0, /*An array of screen rectanges to clear*/
D3DCLEAR_TARGET | /*The render target surface, most likely the backbuffer*/
D3DCLEAR_ZBUFFER, /*The depth(z) buffer*/
0x00000000, /*Colour that we wish to clear the render targer to (black)*/
1.0f, /*The value that we wish to set the depth(z) buffer to*/
0); /*The value that we wish to set the stencil buffer to*/ <-Right here :S
/*Function to Present the contents of the next buffer*/
m_d3dDevice->Present(0, /*This must be NULL as we didn't specify the swap chain as "D3DSWAPEFFECT_COPY"
as it is NULL, the whole surface is presented*/
0, /*This must also be NULL for the same reason, as it is NULL, the entire client area is filled*/
0, /*This is the destination window, if NULL, then the handle from D3DPRESENT_PARAMETERS is taken*/
0); /*This must also be NULL as "D3DSWAPEFFECT_COPY" wasn't specified*/
return true; /*Return a true value, indicating that the program can continue*/
Did you check to make sure your device creation succeeded? In debug uninitialized pointers are set to 0xcccccccc so that is a good hint of something to check when you see that.
Perhaps you need to learn some more C++ before tackling a project using DirectX and/or the DirectX framework classes from Microsoft.
I agree, I think i'm going to go back and create a text based game before moving onto graphics :'( Worth a try though ;)
Originally Posted by Bubba
I have to commend you for taking my advice so well. Most would have been offended. Some do not seem to realize there is nothing wrong with admitting you might need more fundamental knowledge before attempting something advanced.
If you maintain that type of learning attitude you will do very well on this forum, in programming, and in the future wherever it may take you.
Thanks Bubba, I've seen your posts and I envy you for your DirectX programming experience, and i'm extremely looking forward to a beta of your space simulation! ;)