GLJPanel and jinternalframe

hi all

i have strange affect using GLJPanel and jinternalframe
i add GLJPanel to jinternalframe and all work well but then i resize my main frame(JFrame) init() occur and i get new OpenGL context(as i understand) but if i resize jinternalframe i dont get init() method is called

in my app i have about 500 texture objects in one frame and to avoid unnecessary computation i cache them and
as a result, after each init() i lose them
also operation creating a new context is expensive enough to

why this hapening and any way to avoid init() method is called after main frame resized?

thx

ps. i use -Dsun.java2d.noddraw=true -Dsun.java2d.d3d=false -Dsun.java2d.opengl=true and jogl 1.1.1

The GLJPanel works by creating a pbuffer that’s actually rendered into, and every frame this is read from the graphics card and drawn onto the GLJPanel. A pbuffer is a fixed-size offscreen render surface, so each time the GLJPanel needs to change size, a new pbuffer has to be created, triggering another init.

Unfortunately, since you’re using a JInternalFrame, it won’t work as well to create a GLCanvas (which doesn’t have the resize init problem, but is a heavy weight component).

thx for the explanation, i see that i need to wait java 7 where i can mix heavy weight and lightweight weight components
but i back to question why resizing jinternalframe don’t effect for new init() call but main frame(JFrame) do

in my app i have GLJPanel ->jinternalframe->JDesktopPane->JFrame component structure

Missed that detail of your question, I’m not sure, but maybe it’s trying to be smart and is making the internal pbuffer the size of the main frame if it detects its inside a JInternalFrame. That way the JIT resizes are faster, but adjusting the main frame triggers what I explained above. This is just a guess though.