Port to JOGL2 questions

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

Port to JOGL2 questions

Martin
Hi guys,

I'm almost done with the "raw" porting of Jzy3d, but I can't find a few things such as:
com.sun.opengl.util.BufferUtil
TextureIO.newTexture(BufferedImage, boolean) seams away. Can I load a buffered image?

In the jogl demo I still can't find on my classpath:
@Root(name="curve") / @Element
com.jogamp.opengl.impl.io.StreamUtil
com.jogamp.opengl.util.glut.gl2.GLUTgl2
NativeSurface
CGcontext

Also, following lines of code don't build in the demos:
this.nurbs = glu.gluNewNurbsRenderer();
glu.gluBeginCurve(nurbs);
glu.gluEndCurve(nurbs);
using javax.media.opengl.glu.GLU

If you think you know the missing jars, just tell me :)
Regards,
Martin

Reply | Threaded
Open this post in threaded view
|

Re: Port to JOGL2 questions

Demoscene Passivist
Administrator
>com.sun.opengl.util.BufferUtil

use com.jogamp.common.nio.Buffers instead ...

>TextureIO.newTexture(BufferedImage, boolean) seams away. Can I load a buffered image?

try com.jogamp.opengl.util.texture.awt.AWTTextureIO.newTexture(GLProfile.getDefault(), tBufferedImage, true);

Hope that helps a little bit. The other things I haven't used myself but I'm pretty sure they are there :)


Reply | Threaded
Open this post in threaded view
|

Re: Port to JOGL2 questions

gouessej
Administrator
In reply to this post by Martin
StreamUtil is in com.jogamp.opengl.util.
GLUT is in com.jogamp.opengl.util.gl2.
NativeSurface is in javax.media.nativewindow.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Port to JOGL2 questions

Martin
Thanks for your hints! I could successfully build jzy3d with jogl2!
I could run some of the most basic demos, but at this point I still have some bugs. I'll take time to seek a little more by myself before sending you my bug list :)
Cheers,
Martin
Reply | Threaded
Open this post in threaded view
|

Re: Port to JOGL2 questions

Martin
Hi again!
I wrote a problem list. Maybe you guys have some hints again?!

------------
(1) When trying to call glu.gluProject, the output coordinate is always (0,0,0). I'm using javax.media.opengl.GLU. It returns true. Djak seems to have the same problem than me.

------------
(2) When resizing a simple chart with an overlay, I got
Exception in thread "AWT-EventQueue-0" javax.media.opengl.GLException: Method "wglGetPixelFormatAttribivARB" not available, which is weird since com.jogamp.opengl.impl.windows.wgl.WGLExt stand on my classpath in jogl.all.jar

------------
(3) I encounter JVM crash for some of jzy's demos, that have nothing really specific but a quite big number of text labels, thus many calls to glutBitmapString. The method handling text display does also call gluProject, gluUnproject, and glRasterPos3f. The crash does not occurs if I do only one screen rendering, but do occur @95% after few refresh (e.g. scaling the scene).
I can easily crash with only 500 text labels.

# Java VM: Java HotSpot(TM) Client VM (10.0-b19 mixed mode, sharing windows-x86)
# Problematic frame:
# C  [nvoglnt.dll+0x2067af]
#
# An error report file with more information is saved as:
# H:\dev\helios\jzy3d.trunk\hs_err_pid5816.log
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.

------------
(4) When using swing -GLJPanel- I always have an exception at initialization. I can ensure my GLAutoDrawable.init() method is called one time only before the exception is thrown.

Caused by: javax.media.opengl.GLException: GLEventListener org.jzy3d.plot3d.rendering.view.Renderer3d@186d4c1 already initialized: AWT-GLJPanel[ com.jogamp.opengl.impl.GLPbufferImpl, GLAnimatorControl: null, GLEventListeners num 1 [org.jzy3d.plot3d.rendering.view.Renderer3d@186d4c1[init true], ]]
        at com.jogamp.opengl.impl.GLDrawableHelper.init(GLDrawableHelper.java:127)
        at javax.media.opengl.awt.GLJPanel$Updater.init(GLJPanel.java:587)
        at com.jogamp.opengl.impl.GLDrawableHelper.init(GLDrawableHelper.java:113)
        at com.jogamp.opengl.impl.GLDrawableHelper.init(GLDrawableHelper.java:126)
        at com.jogamp.opengl.impl.GLPbufferImpl$InitAction.run(GLPbufferImpl.java:303)
        at com.jogamp.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:284)
        at com.jogamp.opengl.impl.GLPbufferImpl.maybeDoSingleThreadedWorkaround(GLPbufferImpl.java:296)
        at com.jogamp.opengl.impl.GLPbufferImpl.display(GLPbufferImpl.java:120)
        at javax.media.opengl.awt.GLJPanel$PbufferBackend.doPaintComponentImpl(GLJPanel.java:1148)
        at javax.media.opengl.awt.GLJPanel$AbstractReadbackBackend.doPaintComponent(GLJPanel.java:919)
        at javax.media.opengl.awt.GLJPanel.paintComponent(GLJPanel.java:311)
        at javax.swing.JComponent.paint(JComponent.java:1027)
        at javax.swing.JComponent.paintToOffscreen(JComponent.java:5122)
        at javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:285)
        at javax.swing.RepaintManager.paint(RepaintManager.java:1128)
        at javax.swing.JComponent._paintImmediately(JComponent.java:5070)
        at javax.swing.JComponent.paintImmediately(JComponent.java:4880)
        at javax.media.opengl.awt.GLJPanel$PaintImmediatelyAction.run(GLJPanel.java:673)

------------
(5) It seems that the GLEventListener.reshape(GLAutoDrawable canvas, int x, int y, int width, int height)
is locked somewhere. Indeed:
(a) I resize, but nothing change
(b) I click th canvas, and reshape() is called and the canvas refreshed

Related: when moving another window on top of the GL canvas, the GL canvas does not refresh and keeps the previous sibbling window displayed until I click in the GL canvas, which seams to be the only way to actually trigger GLEventListener.display(GLAutoDrawable)


Hope you have some ideas!
Regards,
Martin

PS: Those wishing to look at the work in progress on Jzy3d can find it here: http://code.google.com/p/jzy3d/source/browse/#svn/trunk/
Reply | Threaded
Open this post in threaded view
|

Re: Port to JOGL2 questions

gouessej
Administrator
You should use gluProject and gluUnproject with floats rather than with doubles until I fix this bug. GLJPanel was very buggy the last time I tried to use it.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Port to JOGL2 questions

Martin
Great suggestion, that works!
Thank you Julien!
Martin
Reply | Threaded
Open this post in threaded view
|

Re: Port to JOGL2 questions

Martin
Hi again,

A little more explanations concerning the reshape() problem: Jzy3d repaints on demand, meaning I do not use an Animator. Scene change, or window size change, trigger a canvas repaint, but no rendering occurs when the screen is static.

I tried not starting the animator of Gear demo, and then the demo display nothing. I found many demos (e.g. gleem) not using an Animator that where not able to render anything in the Canvas. Is there something wrong with the AWT implementation? Would Newt/Nativewindow help with those problems?

For the moment I can cope by adding a ComponentListener to my canvas that queries canvas.forceRepaint(); when it is resized so I'm not lost!

Let me know if you have more info on GLJPanel!

Regards,
Martin
Reply | Threaded
Open this post in threaded view
|

Re: Port to JOGL2 questions

gouessej
Administrator
Hi!

I don't use any animator in TUER as far as I know and it works, I call display() explicitly. However, what I did was almost like using an animator. I advise you to use an animator but put a flag into your rendering code to redraw nothing when it is not necessary and disable the auto swap buffer mode in your canvas.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Port to JOGL2 questions

Martin
OK, thanks, I'll think about using the animator.
Regards,
Martin
Reply | Threaded
Open this post in threaded view
|

Re: Port to JOGL2 questions

Martin
In reply to this post by Martin
Hi folks,
Long time no see :) Just a message to tell you that I tried december 13 release that solves bugs 3 and 4 in my message, meaning:
- no more JVM crash with a huge number of glutBitmapString
- no more Exception at GLJPanel init

So many thanks to you guys for solving these problems. Jzy3d is doing its way to the 0.9 :)
Martin
Reply | Threaded
Open this post in threaded view
|

Re: Port to JOGL2 questions

Wade Walker
Administrator
Excellent! Glad to hear that things are going well

Do you still see your problem 1 (zero coordinate returned from gluProject)? I saw that in some older versions in gluUnProject, but it seems to be fixed now.
Reply | Threaded
Open this post in threaded view
|

Re: Port to JOGL2 questions

gouessej
Administrator
Sven used his fix for gluUnproject, I lost mine that was heavier but a bit more accurate.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Port to JOGL2 questions

Martin
In reply to this post by Wade Walker
I made what Julien suggested: using gluProject and gluUnproject with floats instead of doubles.
Reply | Threaded
Open this post in threaded view
|

Re: Port to JOGL2 questions

Wade Walker
Administrator
It looks like GLU.gluProject() and GLU.gluUnProject() were fixed to work with doubles on November 11, 2010 (in commit d6750dfe8de1d3606f00ad8263d6060a937f33e5).

Could you try it with doubles again and see if there's still a problem? If so, I'll write a unit test and open a bug.
Reply | Threaded
Open this post in threaded view
|

Re: Port to JOGL2 questions

Martin
Hi Wade! I confirm the bug is fixed: jzy3d can work again with doubles.
Martin
Reply | Threaded
Open this post in threaded view
|

Re: Port to JOGL2 questions

Zere
Hi guys,

I'm using the GLU.gluProject() method with double parameters but I don't know why the in the SwingCanvas nothing is show. and when I try to resize the window the following exception is thrown:

Exception in thread "AWT-EventQueue-0" javax.media.opengl.GLException: GLEventListener org.jzy3d.plot3d.rendering.view.Renderer3d@17fa65e already initialized: AWT-GLJPanel[ com.jogamp.opengl.impl.windows.wgl.WindowsOffscreenWGLDrawable, GLAnimatorControl: null, GLEventListeners num 1 [org.jzy3d.plot3d.rendering.view.Renderer3d@17fa65e[init true], ]]
        at com.jogamp.opengl.impl.GLDrawableHelper.init(GLDrawableHelper.java:127)
        at javax.media.opengl.awt.GLJPanel$Updater.init(GLJPanel.java:587)
        at javax.media.opengl.awt.GLJPanel$InitAction.run(GLJPanel.java:659)
        at com.jogamp.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:284)
        at javax.media.opengl.awt.GLJPanel$SoftwareBackend.doPaintComponentImpl(GLJPanel.java:1005)
        at javax.media.opengl.awt.GLJPanel$AbstractReadbackBackend.doPaintComponent(GLJPanel.java:919)
        at javax.media.opengl.awt.GLJPanel.paintComponent(GLJPanel.java:311)
        at javax.swing.JComponent.paint(JComponent.java:1029)
        at javax.swing.JComponent.paintChildren(JComponent.java:862)
        at javax.swing.JComponent.paint(JComponent.java:1038)
        at javax.swing.JComponent.paintChildren(JComponent.java:862)
        at javax.swing.JComponent.paint(JComponent.java:1038)
        at javax.swing.JLayeredPane.paint(JLayeredPane.java:567)
        at javax.swing.JComponent.paintChildren(JComponent.java:862)
        at javax.swing.JComponent.paint(JComponent.java:1038)
        at javax.swing.JViewport.paint(JViewport.java:747)
        at javax.swing.JComponent.paintChildren(JComponent.java:862)
        at javax.swing.JComponent.paint(JComponent.java:1038)
        at javax.swing.JComponent.paintChildren(JComponent.java:862)
        at javax.swing.JSplitPane.paintChildren(JSplitPane.java:1030)
        at javax.swing.JComponent.paint(JComponent.java:1038)
        at javax.swing.JComponent.paintToOffscreen(JComponent.java:5124)
        at javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:278)
        at javax.swing.RepaintManager.paint(RepaintManager.java:1224)
        at javax.swing.JComponent._paintImmediately(JComponent.java:5072)
        at javax.swing.JComponent.paintImmediately(JComponent.java:4882)
        at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:785)
        at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:713)
        at javax.swing.RepaintManager.seqPaintDirtyRegions(RepaintManager.java:693)
        at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:125)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

It seems the same problem that Martin mention On Nov 06, 2010; 12:04pm.

I'm working with:
- the jzy3d 0.9 version (al least is what it is write in the build.xml file)
- jogl2
-Win7 (64 bit)

Are you sure that the GLU.gluProject()  method work properly even with double parameters?

Thank you in advance!!

Zere

Reply | Threaded
Open this post in threaded view
|

Re: Port to JOGL2 questions

gouessej
Administrator
Hi!

GLU.gluProject() method which uses double parameters uses Sven's fix, this bug has nothing to do with gluProject(), it is a remaining bug of GLJPanel in my humble opinion.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Port to JOGL2 questions

Shyko
In reply to this post by Demoscene Passivist
Thx  very much,

Reply | Threaded
Open this post in threaded view
|

Re: Port to JOGL2 questions

elect
In reply to this post by Martin
Martin wrote
Also, following lines of code don't build in the demos:
this.nurbs = glu.gluNewNurbsRenderer();
glu.gluBeginCurve(nurbs);
glu.gluEndCurve(nurbs);
using javax.media.opengl.glu.GLU
Hi, any news regarding this?