<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://jogamp.org/bugzilla/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.2"
          urlbase="https://jogamp.org/bugzilla/"
          
          maintainer="sgothel@jausoft.com"
>

    <bug>
          <bug_id>642</bug_id>
          
          <creation_ts>2012-11-21 09:25:13 +0100</creation_ts>
          <short_desc>Exception when adjusting JSplitPane containing GLCanvas in RC11.</short_desc>
          <delta_ts>2012-12-22 06:07:05 +0100</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>3</classification_id>
          <classification>JogAmp</classification>
          <product>Jogl</product>
          <component>awt</component>
          <version>2</version>
          <rep_platform>All</rep_platform>
          <op_sys>windows</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>---</priority>
          <bug_severity>critical</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Mikael Christensen">mikaelhc</reporter>
          <assigned_to name="Sven Gothel">sgothel</assigned_to>
          <cc>gouessej</cc>
          
          <cf_type>---</cf_type>
          <cf_scm_refs>jogl 1ae0737f34143a5ed655bd9c4d5fe9b0437c7774
jogl 4fa7bfd2018fe5a5c08157a26be22af194839718</cf_scm_refs>
          <cf_workaround>---</cf_workaround>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1998</commentid>
    <comment_count>0</comment_count>
    <who name="Mikael Christensen">mikaelhc</who>
    <bug_when>2012-11-21 09:25:13 +0100</bug_when>
    <thetext>In RC11 of JOGL, I get the following exception when adjusting a JSplitPane, containing a GLCanvas:

Unable to create temp OpenGL context for device context 0xe20124de

The problem is only encountered on Windows, and only on RC11 (RC10 worked). The problem disappears when changing to GLJPanel.

I&apos;ve encountered the error on:
Geforce 310M - Win7 Pro 64-bit - Driver 306.23 - JOGL2.0-RC11
Geforce 310M - Win7 Pro 64-bit - Driver 306.97 - JOGL2.0-RC11
Geforce GTX570 - Win Vista 32-bit - Driver 296.70 - JOGL2.0-RC11
Geforce GTX570 - Win Vista 32-bit - Driver 306.97 - JOGL2.0-RC11

The code works on JOGL2.0-RC10 on all my test machines.

The code works on JOGL2.0-RC11 on macs. I&apos;ve tested on Mac Mini (Geforce 9400M)
and Macbook Air (HD3000).

Full exception: 

Exception in thread &quot;Timer-0&quot; java.lang.RuntimeException: javax.media.opengl.GLException: Unable to create temp OpenGL context for device context 0xe20124de
	at jogamp.common.awt.AWTEDTExecutor.invoke(AWTEDTExecutor.java:58)
	at jogamp.opengl.awt.AWTThreadingPlugin.invokeOnOpenGLThread(AWTThreadingPlugin.java:103)
	at jogamp.opengl.ThreadingImpl.invokeOnOpenGLThread(ThreadingImpl.java:205)
	at javax.media.opengl.Threading.invokeOnOpenGLThread(Threading.java:172)
	at javax.media.opengl.Threading.invoke(Threading.java:191)
	at javax.media.opengl.awt.GLCanvas.display(GLCanvas.java:449)
	at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:74)
	at com.jogamp.opengl.util.AnimatorBase.display(AnimatorBase.java:142)
	at com.jogamp.opengl.util.FPSAnimator$1.run(FPSAnimator.java:128)
	at java.util.TimerThread.mainLoop(Unknown Source)
	at java.util.TimerThread.run(Unknown Source)
Caused by: javax.media.opengl.GLException: Unable to create temp OpenGL context for device context 0xe20124de
	at jogamp.opengl.windows.wgl.WindowsWGLContext.createImpl(WindowsWGLContext.java:306)
	at jogamp.opengl.GLContextImpl.makeCurrentWithinLock(GLContextImpl.java:572)
	at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:485)
	at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:645)
	at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:594)
	at javax.media.opengl.awt.GLCanvas$8.run(GLCanvas.java:996)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.awt.EventQueue.access$400(Unknown Source)
	at java.awt.EventQueue$2.run(Unknown Source)
	at java.awt.EventQueue$2.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)

Sample code reproducing the error (adjust the splitter to trigger a crash - resizing the window works):

public class JoglTest extends JFrame {	
	private static final long serialVersionUID = 1L;

	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
		    public void run() {
		    	new JoglTest();
		    }
		});			
	}
	
	public JoglTest() {
		Container contentPane = getContentPane();
		
		JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
		splitPane.setResizeWeight(0.5d);

		GLCanvas gc = new GLCanvas(new GLCapabilities(GLProfile.getDefault()));
		splitPane.setLeftComponent(gc);
		splitPane.setRightComponent(new JPanel());		
		contentPane.add(splitPane, BorderLayout.CENTER);

		FPSAnimator animator = new FPSAnimator(gc, 100);
		animator.start();
		
		pack();
		setVisible(true);
		setSize(new java.awt.Dimension(824,568));
	}
}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1999</commentid>
    <comment_count>1</comment_count>
    <who name="Julien Gouesse">gouessej</who>
    <bug_when>2012-11-21 12:02:17 +0100</bug_when>
    <thetext>It is not reproducible under GNU Linux (Mageia Linux 2, Nvidia Quadro NVS 285).

Please can you try to get the profile rather in a static initializer?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2000</commentid>
    <comment_count>2</comment_count>
    <who name="Mikael Christensen">mikaelhc</who>
    <bug_when>2012-11-21 12:12:16 +0100</bug_when>
    <thetext>I&apos;m not sure exactly what you mean?

I tried creating a static GLProfile and passing it to the GLCanvas constructor, but it still crashes:

static GLProfile p;
static {
  p = GLProfile.getDefault();
}

Btw, the stack trace contains a WindowsWGLContext reference, so it seems to be Windows specific.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2029</commentid>
    <comment_count>3</comment_count>
    <who name="Mikael Christensen">mikaelhc</who>
    <bug_when>2012-12-07 10:12:20 +0100</bug_when>
    <thetext>Hi, anything new on this bug? Can I provide more information to help the process?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2030</commentid>
    <comment_count>4</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2012-12-07 16:03:46 +0100</bug_when>
    <thetext>Probably related to bug 586, validating now ..</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2039</commentid>
    <comment_count>5</comment_count>
    <who name="Mikael Christensen">mikaelhc</who>
    <bug_when>2012-12-11 14:12:43 +0100</bug_when>
    <thetext>As discussed in this thread: http://forum.jogamp.org/Swing-application-crashing-when-resizing-OpenGL-GLJPanel-window-td4027441.html, I found a workaround for this bug - if I put the GLCanvas inside a jawa.awt.Container and add this component to the JSplitPane, I no longer get crashes

e.g.:

Container viewerContainer = new Container();
viewerContainer.setLayout(new BorderLayout());
viewerContainer.add(myGLCanvas);
myJSplitPane.setLeftComponent(viewerContainer);
     
It seems the OpenGL context is no longer lost when resizing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2048</commentid>
    <comment_count>6</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2012-12-22 05:43:13 +0100</bug_when>
    <thetext>Fixed the root cause of the exception w/ commit 1ae0737f34143a5ed655bd9c4d5fe9b0437c7774.

However, yes - this workaround seems to be nice - especially for Windows,
where the mixed Lw/Hw JSplitPanel issue a remove/add when splitter is moved.
Note: This does not appear to happen on X11 ..</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2049</commentid>
    <comment_count>7</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2012-12-22 06:07:05 +0100</bug_when>
    <thetext>commit 4fa7bfd2018fe5a5c08157a26be22af194839718
demonstrates the Container use ..</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>