Jump to content
  • Advertisement

Archived

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

gimp

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

This topic is 5360 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!