Newbie question

Started by
1 comment, last by nobble 13 years, 6 months ago
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.
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?


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.

This topic is closed to new replies.

Advertisement