my screen goes green

Started by
5 comments, last by spetnaz_ 20 years, 6 months ago
ok, assume iam very new to DX. i create a DX object, DX device. then i use CreateOffscreenPlainSurface to create a IDirect3DSurface9, then chuck an image in with D3DXLoadSurfaceFromFile. chuck all that into backbuffer. when escape is pressed PostQuitMessage(WM_QUIT) ends the message loop and i clean up the DX with g_pBitmapSurface->Release and so on,doing it in the reverse order i created the objects. when my program runs and i press escape the screen flashes black then green for a split second. why? and how do i stop the program from doing it? thanx for replies.
www.programmers-unlimited.com, try it, its not too bad.
Advertisement
(checking the obvious) Are you clearing to green anywhere?
+dr1ft
no iam not, all the cleaning i do is

void CleanUpDirect3D(void)
{
if(g_pBitmapSurface)
{
g_pBitmapSurface->Release();
}

if(g_pDirect3DDevice)
{
g_pDirect3DDevice->Release();
}

if(g_pDirect3D)
{
g_pDirect3D->Release();
}
}

might green be a default or something, any ideas?
www.programmers-unlimited.com, try it, its not too bad.
He meant the color you''re IDirect3DDevice8/9::Clear()''ing your back-buffer to.


Muhammad Haggag
MHaggag''s corner

here is how i render it:

void Render(void)
{
IDirect3DSurface9* pBackBuffer = NULL;
g_hResult = g_pDirect3DDevice->GetBackBuffer(0,0,D3DBACKBUFFER_TYPE_MONO,
&pBackBuffer);

if(FAILED(g_hResult))
{

PostQuitMessage(WM_QUIT);
}

g_hResult = g_pDirect3DDevice->StretchRect(g_pBitmapSurface, NULL,
pBackBuffer, NULL, D3DTEXF_NONE);

if(FAILED(g_hResult))
{
strcpy(g_szErrorMsg, "error copying image");
PostQuitMessage(WM_QUIT);
}

g_pDirect3DDevice->Present(NULL,NULL,NULL,NULL);

if(pBackBuffer)
{
pBackBuffer->Release();
}

}

get a backbuffer up,StretchRect the sucker, present, clear up backbuffer, do it all over again.

any ideas why it goes green when i end the program
www.programmers-unlimited.com, try it, its not too bad.
1. Check the debug output. When some errors occur, the debug D3D runtime will flash your screen between green and magenta to give you a clue that something is wrong. In these cases, the debug output will tell you exactly what it''s unhappy about.

2. Some swap effects [potentially] give you a fresh back buffer surface every frame which may be full of garbage - to stop you from relying on the existing contents of that buffer, the debug runtime clears the surface to green/magenta.

3. A single flash on shutdown is related to one of the above, but is usually nothing to worry about. It won''t happen on the retail Direct3D runtimes.

--
Simon O''Connor
3D Game Programmer &
Microsoft DirectX MVP

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

thats the thing, i installed the nondebug/retail version of DX because i dont want my DX programs to have any overhead with this debug info. i have noticed that ATI demos from www.ati.com also do the same thing, when exiting them the screen flashes green.

it might be my hardware:
DELL 8300
P4HT 3GHz
RADEON 9800 PRO
512 MB of RDRAM

OK, if i cant stop it from going green, can i mask it so if though it does flash green no one will ever see it doing so?!

BTW this green flashing thing only happends with my demos, ati demos, but with no other DX applications like retail games.
www.programmers-unlimited.com, try it, its not too bad.

This topic is closed to new replies.

Advertisement