dhakim's picture

WinGLContext Could not make current after waking computer from sleep

Project:The Open Toolkit library
Version:1.0-2010-10-06
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

I'm getting a strange exception on one of my test computers in the lab every time the computer is woken up from sleep while our UI is running. All paint calls made for some period of time throw a GraphicsContextException during the control.MakeCurrent(). The windows error code reported appears to mean that no error occurred...

OpenTK.Graphics.GraphicsContextException: Failed to make context 262144 current. Error: 0
at OpenTK.Platform.Windows.WinGLContext.MakeCurrent(IWindowInfo window)
at OpenTK.Graphics.GraphicsContext.MakeCurrent(IWindowInfo window)

These exceptions will eventually stop occurring after the computer is fully awake, so I can try catch them and prevent my program from crashing, however, if I do so, the GLControls refuse to repaint until the screen is resized. This second issue may be something stupid in my code and I am continuing to look for it, but I am quite curious as to why the exception is being thrown at all.

The computer in question is a

Windows 7 Professional

System
--------------------------------------------------------------------------------

Manufacturer Dell Inc.
Model Latitude E6400
Total amount of system memory 4.00 GB RAM
System type 64-bit operating system
Number of processor cores 2

Graphics
--------------------------------------------------------------------------------

Display adapter type Mobile Intel(R) 4 Series Express Chipset Family
Total available graphics memory 1695 MB
Dedicated graphics memory 64 MB
Dedicated system memory 0 MB
Shared system memory 1631 MB
Display adapter driver version 8.15.10.2182
Primary monitor resolution 1280x800
DirectX version DirectX 10

I'm off to try updating graphics card drivers, but if anyone knows any way to prevent the exception being thrown, or to recover gracefully from it without a full restart of the application (or forcing user to workaround by resizing the screen), I would be interested in it.

Note: The exception always contains the number 262144 as the context number, I have no idea if that is meaningful or not.

Note2: I am not entirely sure how to check my OpenTK version number, the build from download now goes to a build from 10-06-2010, and I believe I have updated since then, so I believe I have the latest.


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

#1

This issue doesn't occur on my Ati system (Win7 64bit, radeon 6310 on 11.7 drivers), which hints at a driver issue. The fact that rendering stops until you resize the monitor is another strong hint.

What is happening here is that wglMakeCurrent fails but does not report a valid reason for this failure (error code 0). OpenTK throws an exception when it detects the failure (if it didn't, your code would crash at some random OpenGL function call which would be even worse).

I'll let you know if I find any workarounds for this issue. Right now, your best bet might be to contact Intel devrel and/or make a post at the http://opengl.org forums.

the Fiddler's picture

#2

Status:open» closed

Please file a bug report at https://github.com/opentk/opentk/issues if you can still reproduce this with OpenTK 1.1 beta4+.