BlueMonkMN's picture

Failed to make context 196608 current. Error: -1073283072

I'm consistently getting an error message like that mentioned in the subject line when performing a particular action in my OpenTK-based program. What's the best way to go about locating and resolving the problem?
Failed to make context 196608 current. Error: -1073283072

AttachmentSize
OpenTKProblem.zip15.28 KB

Comments

Comment viewing options

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

The only relevant result in google has to do with wglCreateContext failing in Maya, but without indication as to why.

What are you trying to do when this error occurs? You say this error is consistent - can you provide a simple app that reproduces it?

BlueMonkMN's picture

I have a modal dialog that displays a preview of how multiple layers of tiles will line up drawn on top of each other. This dialog has an embedded "Display" control, which is my control that inherits from GLControl and implements a number of framework functions for my engine. The control has worked fine in all other cases, but in this particular dialog, it fails consistently, and I don't know why it would fail here and nowhere else, so it's hard to say how I could create a simple application demonstrating the problem. You could, however, download the SGDK 2.1 beta that I just released and I could provide you with a project file that you could use to easily reproduce the problem if you're interesting in going to the trouble. If I ignore the error (catch it and discard it) everything seems to work fine (there's only the one display, so there's not really much choice about which context is active), but for some reason it's throwing this exception. I thought it might have something to do with the modal dialog, but making it modeless didn't fix anything. If I simply comment out the MakeCurrent call, everything works fine, but I worry that if there are multiple displays active, I might interact with the wrong one if I don't have this call.

BlueMonkMN's picture

I decided to copy my Display control to a new applicattion, strip it down to the bare minimum and try using it to see if the problem occurred there too, and it does. If I can figure out a way to attach the archive of the source code to this message, I will. The display draws fine initially, but causes the error if you re-size or hide and show any portion of the form (cause it to repaint).

BlueMonkMN's picture

Hm... I may have stumbled across a solution to my problem here. Apparently I neglected to call Flush on my display (which is what's responsible for the GL.End). Why do I get such a screwy error message as a result?

the Fiddler's picture

Changing the current context actually flushes the command buffer, so I'm not sure that's the problem. I just tried running the program on Linux and there's no crash (and garbage for output). I also tried running on Mesa 7.0.3 (Windows) but the output is empty (no crash here either). I'm building Mesa 7.2 now to test.

Edit: No change with Mesa 7.2 either. The program doesn't crash, but doesn't display anything either.

Edit 2: Ok, the empty window may be a Mesa3d issue, so no worries there. I'll reboot to windows and check natively.

BlueMonkMN's picture

Well, I can tell you that when I added a GL.End, it fixed everything, so that must have been the problem.
Do you think the program is coded incorrectly, or is there something wrong with Linux/Mesa causing it not to output anything?
Could it simply be the fact that GL.End was never called that causes it not to output anything... maybe this is an undefined use case.

the Fiddler's picture

The garbage looked as if GL.Clear and SwapBuffers were never called - which can probably occur by a missing GL.End.

BlueMonkMN's picture

But you didn't get any error messages? Even under native Windows?

the Fiddler's picture

Nope. According to the (somewhat confusing) docs:

"GL_INVALID_OPERATION is generated if glGetError is executed between the execution of glBegin and the corresponding execution of glEnd. In this case glGetError returns 0."

So, if it's a missing GL.End, GL.GetError won't help.