Lost Textures

I’ve got JOGL in a tab panel. When I switch between tabs I lose the texture information. We cue off the gl context to determine whether we need to re-call glBindTexture. I’m not seeing this change, but I lose the texture. If I change our code(Aviatrix3d) to bind the texture each frame then its fine.

Anyone seen this happen before. The code is in a pretty big application but I can move it to something smaller to show the issue if needed.

It feels like we’ve changed contexts but I’m not seeing a new one.

Try to insert a debug message in your init method and see how often it gets called. Maybe you are actually getting a new context every time. GLJPanel creates a new context on every frame.

init is only called once not matter how many times I switch between tab panels.

I’m pretty sure there are subtle issues with GLCanvas in JTabbedPane. JTabbedPane is a lightweight widget so I don’t know how well switching between tabs is going to work when you add a heavyweight widget to it. Take a look at (closed) Issue 111 on the JOGL Issue Tracker and see if the test case is similar to the behavior you’re seeing. I would recommend trying the following:

[]Specify -Dsun.java2d.noddraw=true .
[
] Check out and build the current JOGL CVS. There are quite a few bug fixes with respect to multithreading which might have led to crashes or other incorrect behavior on some drivers. This source will be released as 1.1 b08 soon.
[] With this build, try specifying -DJOGL_SINGLE_THREADED_WORKAROUND=true if you aren’t on Windows on an ATI card and see if that changes or improves the behavior.
[
] With this build, try using a GLJPanel instead of a GLCanvas. GLJPanel is now hardware-accelerated where possible and we are seeing pretty good performance at least on NVidia hardware. The GLJPanel should have 100% Swing compatibility.
[*] Try removing the GLCanvas from the JTabbedPane when you switch away from its tab and add it back again when you switch to its tab.

If none of these suggestions help, please make a small test case and file a bug with the JOGL Issue Tracker.