DebugGL and GLContext

Hi all,

I’m building an app where a series of gl drawing commands can be called by two different viewers, so as to render something in both a GLCanvas and a GLPbuffer (which shares the same context with the GLCanvas). I was getting some errors, and I used the DebugGL object to find out wht was going wrong. With every render cycle, a new DebugGL object was created, and subsequent rendering commands were issued using the new DebugGL object. I found my errors, but I noticed that when using the DebugGL object I got a GLException " This GL object is being incorrectly used with a different GLContext than that which created it". I checked the DebugGL code, and this exception is thrown if the context of the DebugGL object is no current. How can this happen since the DebugGL object is created from scratch each time something is rendered? Why I’m not getting the same error when using GL instead of DebugGL?

I suspect you may have gotten confused about which GL object you were using. In e.g. the Gears source code we create and install the DebugGL in the init() method of the GLEventListener, which is probably the most correct and efficient place to do it. The base GL class does no error checking in this area, only the DebugGL.