Problems with GLJPanel

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

Problems with GLJPanel

Lili
This post was updated on .
Hello Everyone,

I have a code that used glCanvas and it worked fine under both Linux and MacOS. However, I had to switch to GLJPanel and now I am having problems on both systems. The code that I use for initializing the GLJPanel is:

frame = new JFrame("MVis_Universe_29 - Panel");
System.out.println(GLProfile.getDefault().toString());
GLCapabilities capabilities = new GLCapabilities(GLProfile.getDefault());
canvas = new GLJPanel(capabilities);
canvas.addGLEventListener(this);
canvas.addKeyListener(this);
canvas.addMouseListener(this);
canvas.addMouseMotionListener(this);
canvas.addMouseWheelListener(this);
frame.add(canvas);
final Animator animator = new Animator(canvas);
frame.addWindowListener(new WindowAdapter()
                        {
                                @Override
                                public void windowClosing(WindowEvent e) {
                                        new Thread(new Runnable() {
                                                public void run() {
                                                        animator.stop();
                                                        System.exit(0);
                                                        }
                                                }).start();
                                        }
                        });
frame.getContentPane().add( canvas, BorderLayout.CENTER );
frame.setSize(windowSizeX, windowSizeY);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
animator.start();

On the Linux machine GLProfile.getDefault().toString() returns GLProfile[GL3bc/GL3bc.hw] and I use GL3 throughout the code even though gl.getClass().getName() returns jogamp.opengl.gl4.GL4bcImpl. As I said this code worked fine when instead of GLJPanel + JFrame I used GLCanvas + Frame. When I switched the texture broke under Linux. Now istead of seeing the PNG file that I use as texture I see a mini-copy (the size of the texture rectangle) of the entire scene.

On the Mac machine nothing seems to work. GLProfile.getDefault().toString() returns GLProfile[GL2/GL2.hw]. I tried to force it to use GL3 by using
GLCapabilities capabilities = new GLCapabilities(GLProfile.get(GLProfile.GL3));
instead of the default one but this doesn't work either and it tells me I can't use GL3bc on a Mac OS

On both machines I am using the most recent jogl libraries and Java 1.6

I would appreciate any help and suggestions you may have.

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Problems with GLJPanel

LordSmoke
Wow, the only original post in the first four pages of the forum without a reply.

Did this get missed by the gurus of jogl, or is there something fundamentally wrong with the posting/question?

Or are folks just ignoring my student, Lili. She really is a very nice person.
Reply | Threaded
Open this post in threaded view
|

Re: Problems with GLJPanel

jmaasing
In reply to this post by Lili
I can at least answer that GL3 is supported on OSX for the last 3 versions.
https://developer.apple.com/graphicsimaging/opengl/capabilities/index.html

This is code I have used that has worked for OSX 10.7, 10.8 and several minor updates of JOGL but it opens a NEWT window.

final GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL3));
caps.setBackgroundOpaque(true);
caps.setDoubleBuffered(true);
caps.setDepthBits(16);
GLWindow glWindow = GLWindow.create(caps);
glWindow.setSize(preferredResolution.width, preferredResolution.height);
glWindow.setUndecorated(false);
glWindow.setPointerVisible(true);
glWindow.setVisible(true);

OSX 10.9 (which support OpenGL 4.1) broke JOGL 2.1.1 but Sven has been working on a fix for that.

Sorry, can't help with the various Panel questions.
Reply | Threaded
Open this post in threaded view
|

Re: Problems with GLJPanel

gouessej
Administrator
In reply to this post by LordSmoke
Hi

GLJPanel has an important drawback, it modifies some states in OpenGL that aren't "reverted" after rendering it, there is an indication about that in the documentation of this class. Please use GLCanvas except in a few particular cases mentioned in the user's guide. In the worst case, use the flag to disable GLSL in GLJPanel.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Problems with GLJPanel

Sven Gothel
Administrator
In reply to this post by Lili
On 10/10/2013 05:40 PM, Lili [via jogamp] wrote:
> Hello Everyone,
>
> I have a code that used glCanvas and it worked fine under both Linux and
> MacOS. However, I had to switch to GLJPanel and now I am having problems on
> both systems. The code that I use for initializing the GLJPanel is:

Dear Lili, dear All,

if you like me to test your code please do the following first:

- Is it covered by JOGL unit tests already ?
  If TRUE, then pls simply reference one of the unit tests.

- Maybe you can copy one of the unit tests
  and make it fit your case. Then pls post it,
  so I can drop it .. (email, git pull, ..)

- At least post a whole class we can drop
  w/o the hassle of reading it, if it works :)
  Sometimes we have regressions and testing
  a whole case first before getting into the details
  would save time.


Of course, emphasizing snippets etc is great
and you still can do that ofc.

Thank you!

~Sven

>
> frame = new JFrame("MVis_Universe_29 - Panel");
> System.out.println(GLProfile.getDefault().toString());
> GLCapabilities capabilities = new GLCapabilities(GLProfile.getDefault());
> canvas = new GLJPanel(capabilities);
> canvas.addGLEventListener(this);
> canvas.addKeyListener(this);
> canvas.addMouseListener(this);
> canvas.addMouseMotionListener(this);
> canvas.addMouseWheelListener(this);
> frame.add(canvas);
> final Animator animator = new Animator(canvas);
> frame.addWindowListener(new WindowAdapter()
>                         {
>                                 @Override
>                                 public void windowClosing(WindowEvent e) {
>                                         new Thread(new Runnable() {
>                                                 public void run() {
>                                                         animator.stop();
>                                                         System.exit(0);
>                                                         }
>                                                 }).start();
>                                         }
>                         });
> frame.getContentPane().add( canvas, BorderLayout.CENTER );
> frame.setSize(windowSizeX, windowSizeY);
> frame.setLocationRelativeTo(null);
> frame.setVisible(true);
> animator.start();
>
> On the Linux machine GLProfile.getDefault().toString() returns
> GLProfile[GL3bc/GL3bc.hw] and I use GL3 throughout the code even though
> gl.getClass().getName() returns jogamp.opengl.gl4.GL4bcImpl. As I said this
> code worked fine when instead of GLJPanel + JFrame I used GLCanvas + Frame.
> When I switched the texture broke under Linux. Now istead of seeing the PNG
> file that I use as texture I see a mini-copy (the size of the texture
> rectangle) of the entire scene.
>
> On the Max machine nothing seems to work. GLProfile.getDefault().toString()
> returns GLProfile[GL2/GL2.hw]. I tried to force it to use GL3 by using
> GLCapabilities capabilities = new GLCapabilities(GLProfile.get(GLProfile.GL3));
> instead of the default one but this doesn't work either and it tells me I
> can't use GL3bc on a Mac OS
>
> On both machines I am using the most recent jogl libraries and Java 1.6
>
> I would appreciate any help and suggestions you may have.
>

> Thanks
>


signature.asc (911 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Problems with GLJPanel

Sven Gothel
Administrator
In reply to this post by LordSmoke
On 10/29/2013 10:37 PM, LordSmoke [via jogamp] wrote:
> Wow, the only original post in the first four pages of the forum without a reply.
>
> Did this get missed by the gurus of jogl, or is there something fundamentally
> wrong with the posting/question?
>
> Or are folks just ignoring my student, Lili. She really is a very nice person.

A student of yours from which school ?
Nice to see an almost non political correct anonymous
nick name for a teacher :)

Yup saw you guys many contributions here,
always welcome - nice to have you here of course.

Maybe one day we can collab a bit more regarding usability
and Graph/UI.

Cheers, Sven



signature.asc (911 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Problems with GLJPanel

LordSmoke
Thanks, folks, for your help.

I am in the enviable position of having students who know more than I do. As someone pointed out, to have otherwise would lead to a downward spiral to scientific mediocrity. So, I will leave it to Lili to digest and act on your suggestions.

I've worked for the past few years getting my software ported to jogl2 and java3d with lots of help from hharrison and others. For the past year, Lili has been working to rewrite my plotter class in shader-based jogl (to give me easy access to fixed and rotatable lines, text, images, meshes, etc). Once that is done, I can use the class to generate new scientific visualizations. As a by-product, Lili is now one of the local experts on jogl and shader-language programming.

She got everything I needed working with GLCanvas, but we need it in a GLJPanel to put in an internal frame. I need all of my program windows contained in the program's own desktop, so we need a lightweight canvas (seemed to work fine with fixed-function demo code I tried). When we moved it over, all the things mentioned broke. She is looking over the suggestions, now.

Sven, PM sent.

Again, Thanks! -LS

Sven Gothel wrote
On 10/29/2013 10:37 PM, LordSmoke [via jogamp] wrote:
> Wow, the only original post in the first four pages of the forum without a reply.
>
> Did this get missed by the gurus of jogl, or is there something fundamentally
> wrong with the posting/question?
>
> Or are folks just ignoring my student, Lili. She really is a very nice person.

A student of yours from which school ?
Nice to see an almost non political correct anonymous
nick name for a teacher :)

Yup saw you guys many contributions here,
always welcome - nice to have you here of course.

Maybe one day we can collab a bit more regarding usability
and Graph/UI.

Cheers, Sven




signature.asc (911 bytes) <http://forum.jogamp.org/attachment/4030416/0/signature.asc>
Reply | Threaded
Open this post in threaded view
|

Re: Problems with GLJPanel

Sven Gothel
Administrator
In reply to this post by Lili
On 10/10/2013 05:40 PM, Lili [via jogamp] wrote:
> Hello Everyone,
>
> I have a code that used glCanvas and it worked fine under both Linux and
> MacOS. However, I had to switch to GLJPanel and now I am having problems on
> both systems. The code that I use for initializing the GLJPanel is:
>

<snip/>

>
> On the Linux machine GLProfile.getDefault().toString() returns
> GLProfile[GL3bc/GL3bc.hw] and I use GL3 throughout the code even though
> gl.getClass().getName() returns jogamp.opengl.gl4.GL4bcImpl.

The only impl. desktop class is GL4bcImpl, for ES it's ES3Impl.
As you see .. we use the highest compat profile for the impl,
since it is the union set of all.

> As I said this
> code worked fine when instead of GLJPanel + JFrame I used GLCanvas + Frame.
> When I switched the texture broke under Linux. Now istead of seeing the PNG
> file that I use as texture I see a mini-copy (the size of the texture
> rectangle) of the entire scene.
>
> On the Max machine nothing seems to work. GLProfile.getDefault().toString()
> returns GLProfile[GL2/GL2.hw]. I tried to force it to use GL3 by using
> GLCapabilities capabilities = new GLCapabilities(GLProfile.get(GLProfile.GL3));
> instead of the default one but this doesn't work either and it tells me I
> can't use GL3bc on a Mac OS
Right, OSX has no compatibility profile, only core.
Since you are interested in core only, simply use GLProfile's
getMaxProgrammable*()

Please have a look into the many unit tests,
after you have managed to get over my incomprehensible style
you may how we use GLProfiles etc. Most tests use core only.

In your developer IDE (Eclipse, NB), please attach the source zip file
(gluegen-rt and jogl-all), so you can see the API doc (mouse over .. etc).
We have a description of this in our Wiki.

>
> On both machines I am using the most recent jogl libraries and Java 1.6

Please use Java7 .. since Java7 is no more maintained
and especially on OSX, Java6 is hardly tested anymore [by me].

>
> I would appreciate any help and suggestions you may have.

Hope this helps a bit ..

And again, sending a complete test case we can drop and test w/o
writing the 'decorations' .. would be helpful.

If we figure you have a 'real bug', pls send a bugreport.
See Wiki/FAQ/Bug.. after we have managed the first one together,
you will see that we are user friendly - hopefully :)

Cheers, Sven

>
> Thanks


signature.asc (911 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Problems with GLJPanel

LordSmoke
Sven Gothel wrote
On 10/10/2013 05:40 PM, Lili [via jogamp] wrote:

...snip...

Please use Java7 .. since Java7 is no more maintained
and especially on OSX, Java6 is hardly tested anymore [by me].

...snip...
When I tried Java7 a few months ago, it broke the Java3D version of my program and, especially important, broke one of my absolute favorite and useful apps, jEdit. I'll give it another go. I see a patched version of jEdit was posted in September. I'll have Lili look at the rest of the suggestions. -LS
Reply | Threaded
Open this post in threaded view
|

Re: Problems with GLJPanel

jmaasing
Off topic:
I have been using jEdit for years, love it :) You can for sure run jEdit on OSX using java7, or Java8. The only "problem" is that the native launcher requires Java6 but you can run it manually
From a console Go into jEdit.app/Contents/Resources/Java and run java -jar jedit.jar

The OSX plugin might not work so it doesn't integrate with the top bar but jEdit works fine :)