green flashes

Started by
7 comments, last by ProgrammingNerd 18 years, 8 months ago
When, I was making my game engine, I forgot to set debug mode in the control panel under DirectX. Anyway, when I run my program, all I get are these green flashes. I suspect that it is the debug runtimes way of telling me that I did something wrong. Man, do I feel stupid right now. Anybody programming in directx should be able to tell me what I'm doing wrong. Except me. Thanks, ProgrammmingNerd
Advertisement
Likely you are failing to Clear before rendering or your calls are failing. The debug output should tell you what's wrong in detail. Forum FAQ
Stay Casual,KenDrunken Hyena
No, I was clearing, except it is failing with error code -858993460. Error lookup doesn't help me at all. Here's the call:

HRESULT hr;hr = m_pD3DDevice->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff0000ff, 1.0f, 0);


Thanks,
ProgrammingNerd
I don't think the error lookup tool takes signed values. You might want to try printing it out as an unsigned value.

But more importantly, what does the debug output say?
Stay Casual,KenDrunken Hyena
That didn't work; there isn't anything coming out of the debug output. I set full debug level in the control panel and all I get in the debug output are some unallocated object errors and those come after I exit.

Thanks for your help, DrunkenHyena
ProgrammingNerd
Have you created/enabled a z-buffer on initialization? (EnableAutoDepthStencil)

Yes, I have. For you information, here is my initialization code:

HRESULT CSWGBasic::CreateBasicDevice(IDirect3DDevice9 **c_pD3DDevice, HWND hWnd){	//Check for valid parameters	if( !hWnd )		return E_FAIL;		IDirect3D9* c_pD3D;	//Create Direct3D	if( NULL == ( c_pD3D = Direct3DCreate9 ( D3D_SDK_VERSION ) ) )		return E_FAIL;	//Setup presentation parameters	D3DPRESENT_PARAMETERS D3DPP;	ZeroMemory( &D3DPP, sizeof(D3DPP) );	D3DPP.BackBufferWidth = 800;	D3DPP.BackBufferHeight = 600;	D3DPP.BackBufferFormat = D3DFMT_X8R8G8B8;	D3DPP.BackBufferCount = 1;	D3DPP.SwapEffect = D3DSWAPEFFECT_DISCARD;	D3DPP.MultiSampleType = D3DMULTISAMPLE_NONE;	D3DPP.MultiSampleQuality = 0;	D3DPP.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;	//D3DPP.PresentationInterval = D3DPRESENT_INTERVAL_ONE;	D3DPP.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;	D3DPP.Windowed = true;	D3DPP.EnableAutoDepthStencil = true;	D3DPP.AutoDepthStencilFormat = D3DFMT_D24S8;	//Create the device	if( FAILED( c_pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd,		D3DCREATE_HARDWARE_VERTEXPROCESSING, &D3DPP, c_pD3DDevice ) ) )	{		c_pD3D->Release();		return E_FAIL;	}		m_pD3DDevice = *c_pD3DDevice;	c_pD3D->Release();	return S_OK;}
Green areas are Direct3Ds way of telling you that a given surface has not been initlized. If you say that it flashes and it ain't the backbuffer, could it be some texture you have not initlized properably?

If it was the backbuffer it should not flash, it should be a constant green color in the background of your objects.

Do you render some sort of UI infront of all your 3D objects that could be a invalid surface?
Finally! I figured it out! Deep in my code, I was rendering the same backbuffer twice(m_pD3DDevice->Present(0, 0, 0, 0)). I don't know how I could have made that mistake, but finally. it's done!

Thanks to all of you who helped me out; without this website I would be so jammed up that I wouldn't know what to do.

PS I just rated all of you.

This topic is closed to new replies.

Advertisement