• Advertisement


This topic is now archived and is closed to further replies.

NULL pointer at CreateDevice

This topic is 5714 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

This is my code for createdevice
bool D3DInit(void)
	iD3D8 = Direct3DCreate8(D3D_SDK_VERSION);
	if(iD3D8 == NULL)
		return false;

	ZeroMemory(&d3ddm, sizeof(D3DDISPLAYMODE));

        //This is the code used for fullscreen

	//d3ddm.Width = 640;

	//d3ddm.Height = 480;

	//d3ddm.RefreshRate = 0; //Default

	//d3ddm.Format = D3DFMT_R5G6B5;

	iD3D8->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &d3ddm); //For windowed mode

	ZeroMemory(&d3dpp, sizeof(D3DPRESENT_PARAMETERS));
	d3dpp.Windowed = true;
	d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
	d3dpp.BackBufferFormat = d3ddm.Format;

        //This is the code used for fullscreen

	//d3dpp.BackBufferFormat = d3ddm.Format;

	//d3dpp.Windowed = false;

	//d3dpp.SwapEffect = D3DSWAPEFFECT_FLIP;

	//d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;

	//d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;

		return false;

	return true;


I can´t find anything wrong with it, still when i try to run it in fullscreen my device becomes a NULL pointer. Any clues? sHaKaZeD

http://www26.brinkster.com/shakazed/ [edited by - shakazed on July 24, 2002 9:29:41 AM]

Share this post

Link to post
Share on other sites
Use the debug runtime, bump up the debug level and look in your debug output.

D3D *will* tell you what the problem is in the output. There is probably a member of the present parameters set to something wrong.

Simon O''Connor
Creative Asylum Ltd

Share this post

Link to post
Share on other sites

  • Advertisement