Directx 9 framework

This is a discussion on Directx 9 framework within the Game Programming forums, part of the General Programming Boards category; The address of m_d3d is indeed 0xcccccccc, but I don't understand now, I did create it :S I initialized it ...

  1. #16
    Student legit's Avatar
    Join Date
    Aug 2008
    Location
    UK -> Newcastle
    Posts
    156
    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.

  2. #17
    Registered User valaris's Avatar
    Join Date
    Jun 2008
    Location
    RING 0
    Posts
    507
    ? 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.

  3. #18
    Student legit's Avatar
    Join Date
    Aug 2008
    Location
    UK -> Newcastle
    Posts
    156
    Quote Originally Posted by valaris View Post
    ? 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:

    Unhandled exception at 0x0014238a in DXEngine.exe: 0xC0000005: Access violation reading location 0xcccccccc.

    in:
    DXGraphics.h
    Code:
    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*/
    }

  4. #19
    Registered User valaris's Avatar
    Join Date
    Jun 2008
    Location
    RING 0
    Posts
    507
    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.

  5. #20
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598
    Perhaps you need to learn some more C++ before tackling a project using DirectX and/or the DirectX framework classes from Microsoft.

  6. #21
    Student legit's Avatar
    Join Date
    Aug 2008
    Location
    UK -> Newcastle
    Posts
    156
    Quote Originally Posted by Bubba View Post
    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

  7. #22
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598
    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.

  8. #23
    Student legit's Avatar
    Join Date
    Aug 2008
    Location
    UK -> Newcastle
    Posts
    156
    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!

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Isometric Tile Engine using DirectX
    By Wraithan in forum Game Programming
    Replies: 3
    Last Post: 07-17-2006, 01:16 PM
  2. DirectSound header issues
    By dxfoo in forum C++ Programming
    Replies: 0
    Last Post: 03-19-2006, 07:16 PM
  3. DirectX - Starting Guide?
    By Zeusbwr in forum Game Programming
    Replies: 13
    Last Post: 11-25-2004, 12:49 AM
  4. DirectX 8 with Borland
    By Tommaso in forum Game Programming
    Replies: 11
    Last Post: 08-12-2003, 10:30 AM

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