Jump to content
  • Advertisement
Sign in to follow this  
nobble

Newbie question

This topic is 2967 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

Hey guys I'm getting back into programming but I am new to directx and I'm stumped here. When I call this call

if (FAILED ( pDevice->CreateOffscreenPlainSurface(640, 480, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &m_pOffScrSurf, NULL)))
{
SHOWERROR( "Create offscreen surface failed", __FILE__, __LINE__ );

}

I no longer can resize my window. Basically I am just clearing the back buffer like any of the demos / tutorials teach but now i want to load in some img files and start putting stuff on the backbuffer. When I call this function I resize the window and it no longer refreshes also with error checking I know I have lost the backbuffer.

Share this post


Link to post
Share on other sites
Advertisement
Okay Update I have traced the fact to WndProc where these functions are called whenever the window is resized.

OnLostDevice();
m_pGraphics->Reset();
OnResetDevice();

Before I created an offscreen surface I could clear the back buffer. After creating an offscreen surface(note: I have not done anything but created it and placed the release.) I now cannot reset the backbuffer and I get an error when trying to clear the back buffer at this point in the Render function

if (FAILED ( pDevice->Clear( 0, 0, D3DCLEAR_TARGET, D3DCOLOR_XRGB( 0, 0, 0 ), 1.0f, 0 )))
{
SHOWERROR( "Error Clearing BB", __FILE__, __LINE__ );
}

I have no idea but i'm guessing that the new offscreen surface is not allowing me to reset the device for some reason. any ideas what i'm missing?


Share this post


Link to post
Share on other sites
I also saw where some people have used sprites to create textures and by placing them on squares make 2d graphics. This is something I may attempt but to create a tile map would that many sprites by a huge drain on the system right from the get go?? I may do it as an experiment but I would still like to know why I can't reset a lost device as soon as I create an offscreen surface.

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!