GLOffscreenAutoDrawable problem with OSX Mavericks

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

GLOffscreenAutoDrawable problem with OSX Mavericks

Bricksnspace
Hi all.

I'm developing a small Java application for LEGO builders that uses OpenGL to display LEGO bricks.
One function is to output an HTML document with bricks type and an embedded image for every brick in a list.
To do that, I use a GLOffscreenAutoDrawable to draw and capturing image with AWTGLReadBufferUtil.readPixelsToBufferedImage method.

It works fine with Linux and OpenJDK, with Windows XP and Seven, and with OSX 10.6.8 (Snow Leopard).
Using the same program with same data in a Mac with OSX Mavericks 10.9.4 (fully updated at today) program produces all solid black images.

I tried with JOGL v.2.1.3 and 2.2.0 and problem is identical.

Ask for "toString" of newly created off-screen buffer gets same result on OSX 10.6 and 10.9, only "instance id" and handles changes.

This is an example for 10.9:

FBOImpl[
    Helper: GLAnimatorControl: null, GLEventListeners num 0 [],
    Drawable: ResizeableImpl[Initialized false, realized true, texUnit 0, samples 0,
    Factory   jogamp.opengl.macosx.cgl.MacOSXCGLDrawableFactory@1c04ec59,
    Handle    0x7fa3fd84b720,
    Caps      GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, one, mono  , hw, GLProfile[GL2/GL2.hw], offscr[fbo]],
    fboI back 0, front 0, num 0,
    FBO front read 0, null,
    FBO back  write 0, null,
    Surface   WrappedSurface[ displayHandle 0x0
, surfaceHandle 0x7fa3fd84b720
, size 200x200
, UOB[ OWNS_SURFACE | OWNS_DEVICE | WINDOW_INVISIBLE ]
, MacOSXCGLGraphicsConfiguration[DefaultGraphicsScreen[MacOSXGraphicsDevice[type .macosx, connection decon, unitID 0, handle 0x0, owner false, NullToolkitLock[]], idx 0],
    chosen    GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, one, mono  , hw, GLProfile[GL2/GL2.hw], offscr[fbo]],
    requested GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, one, mono  , hw, GLProfile[GL2/GL2.hw], on-scr[.]]]
, surfaceLock <7c514f7f, 3e3a5a9c>[count 0, qsz 0, owner <NULL>]
, OSXDummyUpstreamSurfaceHook[pixel 200x200]
, upstreamSurface false ]],
    Context: null,
    UpstreamWidget: null]

Thank you for your work on JOGL.

Reply | Threaded
Open this post in threaded view
|

Re: GLOffscreenAutoDrawable problem with OSX Mavericks

gouessej
Administrator
Hi

In the meantime, you can use java.awt.Robot.createScreenCapture(Rectangle) to make a screen capture.

Please don't use an old version of JOGL. Can you reproduce your bug with one of our unit tests or provide a rudimentary example?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: GLOffscreenAutoDrawable problem with OSX Mavericks

Bricksnspace
Thank you for your quick reply.

I managed to do a short program that expose the problem, and copied source on Pastebin:

http://pastebin.com/cg5Qsmmd

Program will create a 100 pixel square image in light pink color, on a png file with alpha channel.
It work on Linux, Windows and Mac OSX 10.6.8.

In OSX 10.9.4 it creates a fully transparent image with no color at all.

Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: GLOffscreenAutoDrawable problem with OSX Mavericks

gouessej
Administrator
You're welcome. Please can you fill a bug report so that we don't forget your bug?
https://jogamp.org/bugzilla/

I'm stuck with an old Mac (OS X 10.6.8), another contributor will have to look at your bug. Your example is self contained and very short, this is exactly what I expected, thanks :)
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: GLOffscreenAutoDrawable problem with OSX Mavericks

Bricksnspace
Done:
bug 1044 https://jogamp.org/bugzilla/show_bug.cgi?id=1044
Let me know if you need more tests or details.

Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: GLOffscreenAutoDrawable problem with OSX Mavericks

gouessej
Administrator
Are you sure you mentioned the right JVM for OS X in your bug report? Isn't it Java 1.7 update 65 instead of Java 1.6 update 65?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: GLOffscreenAutoDrawable problem with OSX Mavericks

Bricksnspace
Here is what java say:

$ java -version
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)
Reply | Threaded
Open this post in threaded view
|

Re: GLOffscreenAutoDrawable problem with OSX Mavericks

gouessej
Administrator
Please look at this question on StackOverflow:
http://stackoverflow.com/questions/24809702/osx-java-upgrade-doesnt-reflect-command-line-version-why

Rather run Oracle Java or OpenJDK and it will work flawlessly. You can get an unofficial build here:
https://github.com/alexkasko/openjdk-unofficial-builds

Edit.: You still use Apple JVM instead of Oracle JVM or OpenJDK, this is the problem.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: GLOffscreenAutoDrawable problem with OSX Mavericks

Bricksnspace
Update now to a freshly installed Jdk 1.7u67 (taken from Oracle).

$ java -version
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

Nothing changed: generated png is still empty.
Reply | Threaded
Open this post in threaded view
|

Re: GLOffscreenAutoDrawable problem with OSX Mavericks

gouessej
Administrator
Sorry :( You should test with OpenJDK too as OpenJDK and Oracle Java don't use the same implementation of the Java2D renderer. OpenJDK uses Pisces (and maybe Marlin in the near future) whereas Oracle Java uses Ductus. Disable the Java2D OpenGL pipeline to be sure that one of those renderers is used.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: GLOffscreenAutoDrawable problem with OSX Mavericks

Bricksnspace
Just tested with OpenJDK 1.7 update 60:
$ env JAVA_HOME="/Users/mario/openjdk_1.7.0_u60/" java -version
openjdk version "1.7.0-u60-unofficial"
OpenJDK Runtime Environment (build 1.7.0-u60-unofficial-b30)
OpenJDK 64-Bit Server VM (build 24.60-b09, mixed mode)

Same issue.
Reply | Threaded
Open this post in threaded view
|

Re: GLOffscreenAutoDrawable problem with OSX Mavericks

gouessej
Administrator
Is it the same with -Dsun.java2d.opengl=false?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: GLOffscreenAutoDrawable problem with OSX Mavericks

Bricksnspace
Tested with:
$ env JAVA_HOME="/Users/mario/openjdk_1.7.0_u60/" java -Dsun.java2d.opengl=false -jar testOffScreen.jar

no change, issue still present.
Reply | Threaded
Open this post in threaded view
|

Re: GLOffscreenAutoDrawable problem with OSX Mavericks

Bricksnspace
A workaround for who face this problem (it is present even in normal GLDrawable, not only in OffScreen GLDrawable): do NOT use AWTGLReadBufferUtil but use a "raw" read with glReadPixels with GL_BGR (do NOT read Alpha channel, the problem in AWT/Mavericks is there).
Here you can see a test program with broken image and correct image:
http://pastebin.com/hspvitwA

HTH
Thank you

Mario


Reply | Threaded
Open this post in threaded view
|

Re: GLOffscreenAutoDrawable problem with OSX Mavericks

gouessej
Administrator
Update your bug report (1044) if necessary.

Edit.: Done.
Julien Gouesse | Personal blog | Website