Jump to content
  • Advertisement
Sign in to follow this  
VitaliBR

Video Settings of my Game

This topic is 2802 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 wonder if there is any site, tutorial or article to comment on the options i can add in my game. For example I do not know how I change my device "filtering mode" / "texture detail" / etc ..

And I can use the following method when changing the Resolution?

   IDirect3DStateBlock9* pStateBlock = NULL;
m_pDevice->CreateStateBlock(D3DSBT_ALL, &pStateBlock);
pStateBlock->Capture();


pStateBlock->Apply();
pStateBlock->Release();


Thanks

Share this post


Link to post
Share on other sites
Advertisement
my thinking is correct?
void DxManager::ChangeScreenResolution(int iWidth, int iHeight, bool bFullscreen)
{
if(bFullscreen && m_pFullscreen) // If we are fullscreen already..
if((iWidth == m_pWidth) && (iHeight == m_pHeight))
return; // Already in requested mode.

d3dpp.Windowed = !bFullscreen;
d3dpp.BackBufferWidth = iWidth;
d3dpp.BackBufferHeight = iHeight;

if(!bFullscreen)
{
RECT client = {0, 0, iWidth, iHeight};
AdjustWindowRect(&client, WS_OVERLAPPEDWINDOW, false);

d3dpp.FullScreen_RefreshRateInHz = 0;
d3dpp.BackBufferFormat = D3DFMT_R5G6B5;

SetWindowLongPtr(wndHandle, GWL_STYLE, WS_POPUP);
SetWindowPos(wndHandle, HWND_TOP, 100, 100, client.right, client.bottom, SWP_NOZORDER | SWP_SHOWWINDOW);
}
else
{
d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
d3dpp.BackBufferFormat = D3DFMT_R5G6B5;

SetWindowLongPtr(wndHandle, GWL_STYLE, WS_POPUP);
SetWindowPos(wndHandle, HWND_TOP, 0, 0, iWidth, iHeight, SWP_NOZORDER | SWP_SHOWWINDOW);
}


direct3dDevice->Reset(&d3dpp);


return;
}

Share this post


Link to post
Share on other sites
Quote:

my thinking is correct?

Partialy yes.

Take this step before changing resolution:
release resources (meshes, vertex/index buffers, render targets, "regular" textures...) based on creation flags (MANAGED, DEFAULT, SYSTEMMEM...) for example:

//some managed "resources" have OnLostDevice()/OnResetDevice() methods
//so you dont need to recreate them from scratch
//they can "survive" device->Reset() method

void DxManager::OnPreReset()//function to release all res.
{
effect1->OnLostDevice();
effect2->OnLostDevice();
effect3->OnLostDevice();
...
//release dynamic V/I B's
vertexBuffer1->Release();
vertexBuffer2->Release();
indexBuffer1->Release();
...
}

void DxManager::OnPostReset()//function to recreate res.
{
effect1->OnResetDevice();
effect2->OnResetDevice();
effect3->OnResetDevice();
...
//here create V/I B's again from scratch
...
}

void DxManager::ChangeScreenResolution(int iWidth, int iHeight, bool bFullscreen)//your function
{
//ommited your code
...
OnPreReset();
device->Reset(newParams)
hr = device->TextCooperativeLevel();//check if succeded
if (succesfuly reseted )
{
OnPostReset();
}
...
}


Check all function that returns HRESULT for possible failure!
Check supported resolutions/backbuffer formats before feeding it into d3dpparams!

You might want to read this also

I am writing this from memory so i might made mistake.

Quote:


...
d3dpp.Windowed = !bFullscreen;//why '!' if you pass bFullscreen as parametar?
//d3dpp.Windowed = bFullscreen;//should be this
...


Share this post


Link to post
Share on other sites
I think the texture detail setting is supposed to reduce texture memory usage, which means you physically have to load smaller resolution textures. SetLOD only controls the mip level used from a texture with mip levels already loaded. In order to selectively load mip map levels from a texture, I think you would have to load the texture with default resolution and then go through all levels (see GetLevelCount) and call GetSurfaceLevel to copy data into another, "reduced" texture while skipping the first "n" number of levels depending on how low the quality is. Then unload the original texture and use the "reduced" texture in its place.

There is also a Filtering setting in most games, which controls sampler state between Point, Linear and Anisotropic (see D3DTEXTUREFILTERTYPE). Newever implementations may also have Pyramidal, Quad, etc. You set that with SetSamplerState for MagFilter and MinFilter states.

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!