Archived

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

gimp

WGL Message:WGL: __wglDDrawSurfaceRestore: IsLost: DDERROR = DDERR_SURFACELOST

Recommended Posts

The following error is seen in the output window in VS.NET''s on my games shutdown. The error occurs when I call DestroyWindow. At that time the renderer''s device and rendering context''s have been released with calls to wglDeleteContext, etc. This has worked in my engine for years. WGL Message:WGL: __wglDDrawSurfaceRestore: IsLost: DDERROR = DDERR_SURFACELOST Has anyone ever seen this? I''m destroying a window that was used for OpenGL rendering. This error is new and I have not toughed that code for months. The only change has been of a different machine with a different video card. So, I updated drivers and DirectX to 9.0b. Didn''t make a difference. Any idea''s of where to go? Perhaps I''m not releasing my rendering context correctly: Here is the relevant bit of code I use to detach opengl from the window. I included this as I can see no other reason that the window destruction would be somehow related to the DDraw subsystem.
void COpenGL::DetachWindow(void)
{
	if (m_Screen.GetType() == CWindow::WINDOWED)
	{
		ChangeDisplaySettings(NULL,0);
		ShowCursor(TRUE);
	}

	if ((HGLRC)m_RenderingContext)
	{
		if (!wglMakeCurrent(NULL,NULL))
			Log << "Couldn''t get current rendering context." << Endl;

		if (!wglDeleteContext((HGLRC)m_RenderingContext))			
			Log << "Couldn''t delete rendering context." << Endl;

		m_RenderingContext = NULL;							
	}

	if ((HDC)m_DeviceContext && !ReleaseDC((HWND)m_Screen.GetHandle(),(HDC)m_DeviceContext))		
	{
		Log << "Couldn''t release device context." << Endl;
		m_DeviceContext = NULL;							
	}
}

//Somewhere else in my engine


void CVideo::Destroy(void)
{
	try
	{
		DestroyWindow((HWND)m_Screen.GetHandle());<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<Exception occurs here
		UnregisterClass(WINDOW_CLASS_NAME, GetModuleHandle(NULL));
	}
	catch(...)
	{
		return;
	}

}


Share this post


Link to post
Share on other sites