   sprite-draw problems
  I am currently having an unhandled exception when i call the sprite->draw function.  It is really weird because I made a temporary sprite and called the draw function right after I loaded my model and it worked there.  I call all of these functions so I know that the sprite is getting initialized and I cannot figure out what my problem is...Error:Unhandled exception at 0x6d15ead5 in Engine.exe: 0xC0000005: Access violation reading location 0x00000044. void SpriteBatch::Initialize(Graphics *graphics){this->graphics = graphics;if (!SUCCEEDED(D3DXCreateSprite((LPDIRECT3DDEVICE9)(graphics->*(graphics->GetGraphicsDevice))(),&p_Sprite)))MessageBox(NULL,"Sprite Creation Failed","Error",MB_OK);}void SpriteBatch::Begin(DWORD value){p_Sprite->Begin(value);}void SpriteBatch::Draw(Texture2D &texture, Vector3 &position, D3DCOLOR color){p_Sprite->Draw(texture.GetTexture(),NULL, NULL, &Vec3ToD3D(position),color);}void SpriteBatch::End(){p_Sprite->End();}btw how do I post code snippets correctly?  I spent a fair amount of time searching and failed.Thanks,John   
  An access violation is usually caused by an invalid pointer.I would guess that your texture is invalid for some reason. Did you check the error codes when you created and loaded it?I can't remember where the posting semantics are. You can find them if you know where they are, though. :-)To post small amounts of code use [ c ] ..code.. [ /c ] but NO spaces between the brackets! I put it in that way so it won't be interpreted as a code snippet.To post larger amounts of code you can use [ source ] ..code.. [ /source ] but NO spaces!Don't forget to click "Show Preview" to see what you're going to post before posting.;  Wow that D3DXCreateSprite function call is an absolute mess...why on earth do you have a cast there?   All a cast would serve to do in this case is cover up a compiler error.   ;  Ahh I found my problem.  For some reason when I loaded my texture I passed it by value instead of by reference and then I released the texture inside the loader... dohQuote: Wow that D3DXCreateSprite function call is an absolute mess...why on earth do you have a cast there? All a cast would serve to do in this case is cover up a compiler error.I am using function pointers in my graphics class and that function returns a void*.  That code is just temporary and will be cleaned up.  I just wanted to make sure it was drawing correctly.Thanks,John   