Bug 934 : OpenGL and Video library conflict on OSX 10.5.5 in eclipse
Last modified: 2008-09-29 20:02




Status:
RESOLVED
Resolution:
DUPLICATE of bug 882
Priority:
P2
Severity:
normal

 

Reporter:
depth
Assigned To:
fry

Attachment Type Created Size Actions
code required to repro. text/plain 2008-09-29 18:14 1.25 KB

Description:   Opened: 2008-09-29 18:13
would have posted in bug #882, but it's already resolved, so opening a new one.

creating a Capture object in OPENGL mode in eclipse causes the processing
application to hang, with no feedback in the eclipse console. creating a
Capture object in P2D works fine, as does running the app in OPENGL mode
without instantiating a Capture object.

i tried the java update mentioned in bug #882, and built a new project with
the same code, but using Java 1.6, and that breaks video completely,
regardless of P2D/OPENGL. (i get a
java.lang.reflect.InvocationTargetException from within Capture's ctor, i
can post the stack separately but i'm more focused on just getting video
and opengl to work together regardless of JVM.)

note that the application does actually run once in a rare while, on the
order of about once every 15-20 tries. it wasn't running at all until i
wrapped the Capture instantiation in a try-catch block, but i'm not sure if
that was chance or if it actually made a difference.

here is the code:
[code]
package main;

import processing.core.*;
import processing.video.*;

public class VideoOpenGLTest_Java1_5 extends PApplet {
static final long serialVersionUID = 0;

private Capture capture;
private boolean bNewFrame = false;

private final boolean USE_OPENGL = false;
private final boolean VID_PLAYER_ACTIVE = true;


public void init () {
super.init();
}

public void setup () {
if (USE_OPENGL) {
size(400, 300, OPENGL);
} else {
size(400, 300, P2D);
}

if (VID_PLAYER_ACTIVE) {
println("INIT CAP");
try {
capture = new Capture(this, 400, 300, 30);
println(Capture.list());
} catch (Exception e) {
println("Capture Exception:"+e);
}
}

println("SETUP COMPLETE");
}

public void draw () {
if (VID_PLAYER_ACTIVE) {
// display video
if (bNewFrame) {
image(capture, 0, 0, 400, 300);
bNewFrame = false;
}
} else {
// simple interaction to make sure things are up and running
background(150, 0, 0);
stroke(255);

if (mousePressed) {
line(mouseX, mouseY, pmouseX, pmouseY);
}
}
}

public void captureEvent (Capture cap) {
cap.read();
bNewFrame = true;
}

public static void main (String args[]) {
PApplet.main(new String[] { "main.VideoOpenGLTest_Java1_5" });
}
}
[/code]
Additional Comment #1 From depth 2008-09-29 18:14
edit]
code required to repro.

didn't format nicely in bug post, so posting as an attachment.
Additional Comment #2 From fry 2008-09-29 18:22
k, re-opening 882 because it appears that the java update only fixed the
problem because it jiggled something on the system. it's some sort of
thread/deadlock issue that needs to be straightened out, i suspect it has
to do with QTJava needing to run on the event thread or something like that.

Capture won't work with Java 1.6 and Eclipse because it'll likely be using
the 64 bit JVM, which is incompatible with QTJava. You can thank Apple for
that one.

*** This bug has been marked as a duplicate of 882 ***
Additional Comment #3 From depth 2008-09-29 20:02
apologies this is not directly related to fixing the bug, but do you have a guess if running
video capture in one app and opengl in another (on the same machine), and having the two
communicate via serial, would cause trouble? are two separate instances of JVM isolated
from one another?

thanks, i'm not really a java coder. really i'm a processing coder. ;)

-e

(In reply to comment #2)
>
>
>
> Additional Comment #2 From
> fry
> 2008-09-29 18:22
>
> <!--
> addReplyLink(2); //-->[reply]
>
>
>
>
> k, re-opening 882 because it appears that the java update only fixed the
> problem because it jiggled something on the system. it's some sort of
> thread/deadlock issue that needs to be straightened out, i suspect it has
> to do with QTJava needing to run on the event thread or something like that.
>
> Capture won't work with Java 1.6 and Eclipse because it'll likely be using
> the 64 bit JVM, which is incompatible with QTJava. You can thank Apple for
> that one.
>
> *** This bug has been marked as a duplicate of 882 ***
>
>