Bug 1364 : OpenGL applet problems
Last modified: 2010-06-05 03:31



Assigned To:

Attachment Type Created Size Actions
short pde and xhtml files application/x-zip-compressed 2009-10-30 03:42 992 bytes

Description:   Opened: 2009-10-30 03:41
The following describes some problems with browser OpenGL applets.

I've tested applets opened using an href target="some_id" (different
applets loading in the same tab) or href target="_blank" (same OR different
applets loading in multiple tabs).

It has been tested on the three different browsers (Mozilla Firefox 3.0,
Internet Explorer 8, Google Chrome 3.0).

Software/Hardware specs: Windows XP Professional ENG SP3 x86 - Intel
Quadcore Q6600 - Ram 4GB - NVidia Geforce FX 8400 HD with NVIDIA drivers -
OpenGL v3.0.0

// creating the repro

The zip contains:
1. a short / simple sketch that creates a few cubes in OpenGL and rotates
the camera based on mouse motion
2. a short xhtml document that contains 8 links, 4 links with a target-id
and 4 links with target-blank

Extract the 2 files, open the sketch, export as applet.
Place the applet in the same folder of the xhtml.
Duplicate that folder by copypasting 4 times, then rename the folders as
applet1, applet2, applet3, applet4: this makes browsers think that the
applets are actually different.
Now turn on the JAVA console - on Windows XP > Control Panel > Java >
Advanced > Java Console > Show console

At this point you can open the html and test the 2 problems described below.

I noticed that after the first few errors, the situation tends to gets
worse (the JOGL loader reverts to another font and light blue graphics,
like the UI skin is breaking or something), but it's a bit random.
As soon as JOGL app launcher breaks, it seems to be unable to recover from
the bugs, so it's best to delete the browser history / cache and restart
the browser after testing each bug.

// repro A

1. click Applet 1 (fixed target) --> works ok
2. click Applet 2 (fixed target) --> error:

Exception in thread "Animation Thread" javax.media.opengl.GLException:
Error making context current: -1073283066

at com.sun.opengl.impl.GLContextImpl.makeCurrent(GLContextImpl.java:134)
at com.sun.opengl.impl.GLContextImpl.makeCurrent(GLContextImpl.java:134)
at processing.opengl.PGraphicsOpenGL.detainContext(PGraphicsOpenGL.java:229)
at processing.opengl.PGraphicsOpenGL.beginDraw(PGraphicsOpenGL.java:274)
at processing.core.PApplet.handleDraw(PApplet.java:1392)
at processing.core.PApplet.run(PApplet.java:1327)
at java.lang.Thread.run(Unknown Source)

If you keep clicking on the various links (fixed target, but alternating
different ones) with the JAVA console open, another error kicks in

Exception in thread "AWT-EventQueue-6" java.lang.UnsatisfiedLinkError:
Native Library C:\Documents and
already loaded in another classloader
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.load0(Unknown Source)
at java.lang.System.load(Unknown Source)
at com.sun.opengl.util.JOGLAppletLauncher$6.run(JOGLAppletLauncher.java:922)
at java.awt.event.InvocationEvent.dispatch(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)

// repro B

This happens on Firefox and Chrome.
I dont know, maybe IE opens up a different JVM for each new tab or new
window (at least it's what it looks, IE is opening a new java console for
all new tabs / windows)

1. click Applet 1 (target _blank) many times, like 10 or more for example
--> surprisingly, it works ok

The browser keeps opening new tabs, with working instances of the applet.
Obviously it will slow depending on what the applet does and the number of
applets, which is not a problem.

2. click on each tab (so that FF gets focus on the tab first) then close it

Exception in thread "Animation Thread" javax.media.opengl.GLException:
Error swapping buffers
at processing.opengl.PGraphicsOpenGL.endDraw(PGraphicsOpenGL.java:374)
at processing.core.PApplet.handleDraw(PApplet.java:1446)
at processing.core.PApplet.run(PApplet.java:1327)
at java.lang.Thread.run(Unknown Source)

it tends to alternate with the first error listed in repro A: (Error making
context current)

// workaround

I havent found any but I'm looking into this...
It looks like it might help avoiding applet issues (I'm not 100% positive yet)
Additional Comment #1 From threesixty3d 2009-10-30 03:42
short pde and xhtml files
Additional Comment #2 From threesixty3d 2009-10-30 04:43
It seems like it's more complex than what I thought.

I just tested this on another machine with a cheap mobo integrated Intel
card (DualCore E4300, OpenGL 1.4.0, XP Pro SP3 x86).

The problem becomes less apparent: I tried loading 20 applets in FF3.5 and
msIE8, and it works initially: the applets are displayed correctly; then I
start closing the tabs, one at a time, giving focus to each one: the JAVA
Console shows a bunch of "Error making context current" and "Error swapping
buffers" after most of the tabs are closed.
A new error appeared too: "Can not destroy context while it's current".
After a while, the JOGL loader breaks apart again.

It's partially random but happens with this lightweight applet and more
frequently with heavier stuff.

It also looks like that if I open many tabs with applets, then close those
quite fast, the amount of errors increases in proportion.
Additional Comment #3 From fry 2010-02-17 20:56
have you tried this with JOGL examples? this sounds complicated enough that
it may not be specific to processing.
This bug is now being tracked here.