Sign in to follow this  
Trillian

Toggling fullscreen

Recommended Posts

Hi! I have never really understood how to manage a fullscreen toggling, I'm currently doing something very simple, and possibly as stupid :
//Make a copy of the D3DPP currently used
D3DPRESENT_PARAMETERS d3dpp = _D3DPP;
//Set the windowed flag to false
d3dpp.Windowed = FALSE;
//Hide the cursor
ShowCursor(FALSE);
//Reset device using the new params
if( FAILED( _Renderer->_D3DDevice->Reset(&d3dpp) ) )
{
	FE2D_LOG(40,"Could not go fullscreen");
	return false;
}
//It worked, set the D3DPP currently used to the temp one
_D3DPP = d3dpp;

I get the "Could not go fullscreen" warning and then all calls to SetFVF and other things fail. I'm pretty sure I'm not doing it the good way. BTW, I have set the D3DPP.BackBufferFormat to R5G6B5 and not unknown. And my window style is the following : _Windowstyle = WS_OVERLAPPED | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN; I'm surely not doing it the good way, could anyone give me a tip or point me a tutorial?

Share this post


Link to post
Share on other sites
Hum... Apron Tutorials completely deletes the window and then re-creates it. There must be an easier way to do this, without losing the direct3D device, no?

Share this post


Link to post
Share on other sites
In dx every creation function have D3DPOOL Pool option. This option tell where the resources will place.

d3dDevice->CreateVertexBuffer( dwNumPolygonIndex*3*sizeof(CUSTOMVERTEX),
0, VertexFVF,
D3DPOOL_SYSTEMMEM, <--- <|0_-|>
&lpVertexBuffer,
NULL );


typedef enum D3DPOOL
{
D3DPOOL_DEFAULT = 0,//Resources placed in agp memory. You must release before reset.
D3DPOOL_MANAGED = 1,//... not need to release resources.
D3DPOOL_SYSTEMMEM = 2,... not need to release resources.
D3DPOOL_SCRATCH = 3, ... not need to release resources.
D3DPOOL_FORCE_DWORD = 0x7fffffff,
} D3DPOOL, *LPD3DPOOL;



if your resources created in the agp memory you must release resources before reset. Run the reset. Then reload the resources.
if resources created in system memory not neet to release an reload resources. Reset will run directly.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this