DirectX9 Blank Screen problem

Started by
15 comments, last by Evil Steve 14 years, 2 months ago
Quote:Original post by macmoy
huh?? so where can i find the info? is this the info?
Quote:
Direct3D9: :====> ENTER: DLLMAIN(00e6e6e0): Process Attach: 00000f54, tid=00000944
Direct3D9: :====> EXIT: DLLMAIN(00e6e6e0): Process Attach: 00000f54
Direct3D9: (INFO) :Direct3D9 Debug Runtime selected.
D3D9 Helper: Enhanced D3DDebugging disabled; Application was not compiled with D3D_DEBUG_INFO
Direct3D9: (INFO) :======================= Hal HWVP device selected

Direct3D9: (INFO) :HalDevice Driver style 9

Direct3D9: :BackBufferCount not specified, considered default 1
Direct3D9: :DoneExclusiveMode


how will i solve this?

Why is that there are 2 computers that can run the application while there are 13 which can't?
That output shows that CreateDevice succeeded: "Direct3D9: (INFO) :======================= Hal HWVP device selected". The error you're getting is coming from somewhere else.
Advertisement
uhmm.. maybe posting the whole code will help us solve this..

#include <windows.h>#include <d3d9.h>#include <d3dx9.h>#pragma comment (lib, "d3d9.lib")#pragma comment (lib, "d3dx9.lib")HWND hWnd;LPDIRECT3D9 d3d;LPDIRECT3DDEVICE9 d3ddev;MSG msg;void LoadDX(){	D3DPRESENT_PARAMETERS d3dpp;	d3d=Direct3DCreate9(32);	ZeroMemory(&d3dpp,sizeof(d3dpp));	d3dpp.hDeviceWindow=hWnd;	d3dpp.SwapEffect=D3DSWAPEFFECT_DISCARD;	d3dpp.BackBufferFormat=D3DFMT_X8R8G8B8;	d3dpp.BackBufferWidth=800;	d3dpp.BackBufferHeight=600;	d3dpp.Windowed=1;		d3d->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hWnd,D3DCREATE_SOFTWARE_VERTEXPROCESSING,&d3dpp,&d3ddev);		}void RenderDX(){	d3ddev->Clear(0,0,D3DCLEAR_TARGET,D3DCOLOR_XRGB(80, 150, 100),1.0f,0);	d3ddev->BeginScene();	d3ddev->EndScene();	d3ddev->Present(0,0,0,0);}void CleanDX(){	d3ddev->Release();	d3d->Release();}LRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){	switch(message)	{	case WM_CLOSE:		PostQuitMessage(0);		break;	}	return DefWindowProc(hwnd,message,wParam,lParam);}int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd){	WNDCLASS wc;	wc.cbClsExtra=0;	wc.cbWndExtra=0;	wc.hbrBackground=(HBRUSH)GetStockObject(0);	wc.hCursor=LoadCursor(0,IDC_ARROW);	wc.hIcon=LoadIcon(0,IDI_APPLICATION);	wc.hInstance=hInstance;	wc.lpfnWndProc=WndProc;	wc.lpszClassName="mje";	wc.lpszMenuName=0;	wc.style=0;	RegisterClass(&wc);		hWnd = CreateWindowEx(0,"mje","DXReady App",WS_OVERLAPPEDWINDOW,200,100,800,600,0,0,hInstance,0);						ShowWindow(hWnd,1);	ShowCursor(true);	LoadDX();	bool Running = true;	while(Running)	{		if(PeekMessage(&msg,0,0,0,PM_REMOVE))		{			if(msg.message==WM_QUIT){Running=false;}			TranslateMessage(&msg);			DispatchMessage(&msg);		}		Sleep(16);		RenderDX();			}	/*Clean*/		CleanDX();	DestroyWindow(hWnd);	UnregisterClass("mje",hInstance);	return msg.wParam;}
The original problem of that code causing it to crash is because you're not checking any return values. CreateDevice() fails, so d3ddev is null, so it'll crash when you call d3ddev->Clear().

Other than that, CreateDevice() will fail is any of the parameters are wrong, or there's no 3D hardware acceleration - which is probably the problem you're experiencing. If there's not a D3D9 driver installed, you can't create a device, and CreateDevice() will fail.
no D3D9 driver makes sense. question: is it possible that the SDK is installed yet no D3D9 Driver?


if Yes, how to install the D3D9 driver? is it the DirectX9 Runtime Installer?
Quote:Original post by macmoy
no D3D9 driver makes sense. question: is it possible that the SDK is installed yet no D3D9 Driver?

if Yes, how to install the D3D9 driver? is it the DirectX9 Runtime Installer?
Yes, it's entirely possible. You can write D3D9 apps if you don't have a D3D9 driver installed.

You just need to install the video driver for whatever the hardware is, e.g. the NVidia display driver, etc.

However - check that's actually the problem; the debug output you posted doesn't seem to be from a machine where it's failing - that output says that CreateDevice succeeded (Or rather it doesn't say it failed, and the debug runtimes will ALWAYS tell you when a function fails).
aw!! so where might be the problem then? 2 pc lets the code run + other pc like my laptop, other students laptop etc. but those 11 can run the code.. :((
Quote:Original post by macmoy
aw!! so where might be the problem then? 2 pc lets the code run + other pc like my laptop, other students laptop etc. but those 11 can run the code.. :((
I don't know, you'll need to find out from the debug output. But D3DERR_NOTAVAILABLE means (According to the docs) "This device does not support the queried technique.", which happens when you try to create a device without any D3D hardware (And it probably happens in other cases too).
The debug runtimes will be able to tell you exactly what feature isn't available (And therefore which one you're not checking for support of - which could be any at the moment).
You should really be checking that D3DFMT_X8R8G8B8 is a valid backbuffer format, and it's a valid format for windowed mode (Which is done with CheckDeviceFormat()).

This topic is closed to new replies.

Advertisement