Archived

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

spetnaz_

my screen goes green

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites