Skip to main content
GameDev.net gamedev.net
🔒 Locked

Toggling fullscreen

Started by Trillian Apr 4, 2006 at 6:33 PM 1 replies 600+ views
Original Post
Trillian
Trillian
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?
Trillian
Trillian
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?
3ddreams
3ddreams
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.