lid6j86's picture

GL Control

I've made it work in the past, though I can't remember how. Basically I'm having glcontrol issues. The real problem is that I don't understand how it works in conjunction with threading, so I keep getting errors such as these:

Cross-thread operation not valid: Control 'glc1' accessed from a thread other than the thread it was created on.
 
Failed to make context 196608 current. Error: 170
 
Failed to swap buffers for context 196608 current. Error: 6

so my question is this: how does gl control work, and how do i ensure that i'm trying to access it on the same thread?


Comments

Comment viewing options

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

When rendering, you need to access it from the same thread as the Windows.Form you added it to, you can't use the GLControl in a background thread. You can however have a shared OpenGL background thread for rendering to a framebuffer or for loading resources etc.. but not an instance of GLControl, which must be on a Form.

Cheers,

Euan

Icarus Scene Engine. OpenTK-based 3D simulation & games solution for Win, Linux, Mac, iOS, Droid:
http://icarus.pointscape.com.sg

See Icarus videos on YouTube