Window resizing

Started by
12 comments, last by pas059 12 years, 2 months ago

LPDIRECT3DSURFACE9 rendersurf_old;
LPDIRECT3DSURFACE9 depthsurf_old;
m_device->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &rendersurf_old);
m_device->GetDepthStencilSurface(&depthsurf_old);
rendersurf_old->Release();
depthsurf_old->Release();

RECT rect;
GetClientRect(m_hwnd, &rect);
int width = rect.right - rect.left;
int height = rect.bottom - rect.top;
m_d3dpp.BackBufferWidth = m_width = width;
m_d3dpp.BackBufferHeight = m_height = height;
DXASSERT(m_device->CreateAdditionalSwapChain(&m_d3dpp, &m_swapchain));
DXASSERT(m_swapchain->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &m_rendersurface));
DXASSERT(m_device->CreateDepthStencilSurface(m_width, m_height, m_d3dpp.AutoDepthStencilFormat, m_d3dpp.MultiSampleType, m_d3dpp.MultiSampleQuality, TRUE, &m_depthsurface, 0));


Is the basic code I'm using and I'm pretty sure it's based on the code from that post.


Advertisement
Hi Syranide,

Thanks your code, which is in native C++. With SlimDX (and also SharpDX and MDX) which are managed frameworks desgned to used with .Net languages (C#, C++ managed, VB,...), not all the methods of Direct3D9 are exposed, and notably [color="#660066"]CreateAdditionalSwapChain().

So, i started to use the "traditional" way: disposing ressources that must be disposed, reseting device, recreate resources. The first results seems sufficient, but this takes more time to code and the execution is probably slower. Anyway, i think that i have no other choice.

Thanks again,
Pascal

Hi Syranide,

Thanks your code, which is in native C++. With SlimDX (and also SharpDX and MDX) which are managed frameworks desgned to used with .Net languages (C#, C++ managed, VB,...), not all the methods of Direct3D9 are exposed, and notably [color=#660066]CreateAdditionalSwapChain().

So, i started to use the "traditional" way: disposing ressources that must be disposed, reseting device, recreate resources. The first results seems sufficient, but this takes more time to code and the execution is probably slower. Anyway, i think that i have no other choice.

Thanks again,
Pascal


Yeah, if it isn't exposed then that would be hard to say the least, unless you can just patch it in there yourself.

Also, as I believe I mentioned above Direct3D9Ex pretty much prevents lost devices from occuring entirely (on Vista and up), but I would assume that your library doesn't support that either then, as I feel like it should've just done that internally for you if it supports it.

Your last option would be to use the D3DPOOL_MANAGED for textures if exposed, however, it's not without issues and doesn't actually solve the problem, it just makes a bit faster as a copy of the texture is kept in system memory at all times.


Hi,
sorry for late reply, i was out of office

I tried with Direct3D9Ex (on vista), this gives the same (bad) results. So the "traditional" way seems to be the only one method. This is what i done, and this works (fortunately).

thanks again
Pascal

This topic is closed to new replies.

Advertisement