Jump to content
  • Advertisement
Sign in to follow this  
Screamer

Problem with LPD3DXSPRITE

This topic is 3557 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm having a problem when I try and go full screen. The game crashes and dumps me in my sprite class. //draw Sprites2D void Graphics_Engine::Draw2DObjects() { D3DXVECTOR3 position(0.0f, 0.0f, 0.0f); // position at 50, 50 with no depth D3DXVECTOR3 center(0.0f, 0.0f, 0.0f); // center at the upper-left corner mSprite->Begin(NULL); mSprite->Draw(sprite, 0, ¢er, &position, D3DCOLOR_XRGB(255,255,255)); mSprite->End(); } void Graphics_Engine::drawScene() { // Clear the backbuffer and depth buffer. gd3dDevice->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffffffff, 1.0f, 0); gd3dDevice->BeginScene(); //sprite Draw2DObjects(); mFX->SetValue(mhLight, &mLight, sizeof(DirLight)); mFX->SetMatrix(mhWVP, &(mWorld*gCamera->getViewMatrix()*gCamera->getProjectionMatrix())); D3DXMATRIX worldInvTrans; D3DXMatrixInverse(&worldInvTrans, 0, &mWorld); D3DXMatrixTranspose(&worldInvTrans, &worldInvTrans); mFX->SetMatrix(mhWorldInvTrans, &worldInvTrans); mFX->SetMatrix(mhWorld, &mWorld); // Setup the rendering FX //mFX->SetValue(mhAmbientLight, &mAmbientLight, sizeof(D3DXCOLOR)); //mFX->SetValue(mhDiffuseLight, &mDiffuseLight, sizeof(D3DXCOLOR)); // HR(mFX->SetValue(mhSpecLight, &mSpecLight, sizeof(D3DXCOLOR))); // HR(mFX->SetValue(mhLightVecW, &mLightVecW, sizeof(D3DXVECTOR3))); mFX->SetTechnique(mhTech); UINT numPasses = 0; mFX->Begin(&numPasses, 0); mFX->BeginPass(0); mFX->EndPass(); for(UINT i = 0; i < numPasses; ++i) { mFX->BeginPass(i); // drawGrid(); // drawCylinders(); //drawSpheres(); std::list<Model*>::iterator it = modelList_.begin(); while( it != modelList_.end() ) { drawObject(*it); ++it; } mFX->EndPass(); } mFX->End(); // mGfxStats->display(); gd3dDevice->EndScene(); // Present the backbuffer. gd3dDevice->Present(0, 0, 0, 0); } D3DXSPRITE_OBJECTSPACE seems like it would make more sense but that just fills a quarter of my screen with a black square. I think i might be calling something out of order or I need some sort of check when i go fullscreen to prevent this crash. Any help would be much appreciated. Thanks, Screamer

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Screamer
I'm having a problem when I try and go full screen. The game crashes and dumps me in my sprite class.
Where in your sprite class exactly?

If you're resetting the device, are you calling ID3DXSprite's OnLostDevice() and OnResetDevice() functions? I suspect you're trying to render with the sprite after calling OnLostDevice() but before OnResetDevice(), during which time the sprite is probably in an invalid state.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!