glClipPlanef not work in Java 11

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

glClipPlanef not work in Java 11

yaqiang
I am developing an open source GIS and scientific computation software MeteoInfo (http://www.meteothink.org). Recently I add 3D plot functions using JOGL 2.3.2 (http://www.meteothink.org/news/meteoinfo_2.0.html). It works fine in my PC with Java 9, but the glClipPlanef function not work in my laptop with Java 11. The related code can be found here: https://github.com/meteoinfo/MeteoInfo/blob/master/MeteoInfoLib/src/main/java/org/meteoinfo/chart/jogl/Plot3DGL.java . I am a quite new user of JOGL and want to know why glClipPlanef function was not supported in Java 11. Or I can use other solution to sovle this problem?
Reply | Threaded
Open this post in threaded view
|

Re: glClipPlanef not work in Java 11

Sven Gothel
Administrator
Hi yaqiang,

please find my reply inline below.

Best,

~Sven

On 10/7/19 4:04 AM, yaqiang [via jogamp] wrote:
> I am developing an open source GIS and scientific computation software
> MeteoInfo (http://www.meteothink.org). Recently I add 3D plot functions using
> JOGL 2.3.2 (http://www.meteothink.org/news/meteoinfo_2.0.html). It works fine
> in my PC with Java 9, but the glClipPlanef function not work in my laptop with
> Java 11.

First, let's have a look at your two configurations
(1) PC + Java9
(2) Laptop + Java11

Your issue with 'glClipPlanef' is probably related to the OpenGL vendor driver
you are using and which differs on your two platforms.
Java9 vs Java11 is highly likely unrelated, but you could test
(1b) PC + Java11

'glClipPlanef' is represented in GL2 as follows:

+++

  /** Entry point to C language function: <code> void {@native
glClipPlanef}(GLenum plane, const GLfloat *  equation) </code> <br>Part of
<code>GL_VERSION_ES_CM</code>, <code>GL_IMG_user_clip_plane</code>,
<code>GL_OES_single_precision</code><br>Alias for:
<code>glClipPlanefIMG</code>, <code>glClipPlanefOES</code>
      @param equation a direct or array-backed {@link java.nio.FloatBuffer}   */
  public void glClipPlanef(int plane, FloatBuffer equation);

  /** Entry point to C language function: <code> void {@native
glClipPlanef}(GLenum plane, const GLfloat *  equation) </code> <br>Part of
<code>GL_VERSION_ES_CM</code>, <code>GL_IMG_user_clip_plane</code>,
<code>GL_OES_single_precision</code><br>Alias for:
<code>glClipPlanefIMG</code>, <code>glClipPlanefOES</code>   */
  public void glClipPlanef(int plane, float[] equation, int equation_offset);

<https://www.khronos.org/registry/OpenGL-Refpages/es1.1/xhtml/glClipPlane.xml>

<https://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/opengl/GL2.html#glClipPlanef(int,%20float[],%20int)>

+++

You see, both depend of having one of the listed extensions being implemented.

Alternatively you could (and maybe should) use the double variant on desktop:

+++

  /** Entry point to C language function: <code> void {@native
glClipPlane}(GLenum plane, const GLdouble *  equation) </code> <br>Part of
<code>GL_VERSION_1_0</code><br>
      @param equation a direct or array-backed {@link java.nio.DoubleBuffer}   */
  public void glClipPlane(int plane, DoubleBuffer equation);

  /** Entry point to C language function: <code> void {@native
glClipPlane}(GLenum plane, const GLdouble *  equation) </code> <br>Part of
<code>GL_VERSION_1_0</code><br>   */
  public void glClipPlane(int plane, double[] equation, int equation_offset);

<https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glClipPlane.xml>

<https://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/opengl/GL2.html#glClipPlane(int,%20double[],%20int)>
+++

> The related code can be found here:
> https://github.com/meteoinfo/MeteoInfo/blob/master/MeteoInfoLib/src/main/java/org/meteoinfo/chart/jogl/Plot3DGL.java .
> I am a quite new user of JOGL and want to know why glClipPlanef function was
> not supported in Java 11. Or I can use other solution to sovle this problem?

Hope the above helps, i.e. use the GL2 variant.
Sorry for the confusion.



--
health & wealth
mailto:[hidden email] ; http://jausoft.com
land : +49 (471) 4707742 ; fax : +49 (471) 4707741
Timezone CET: PST+9, EST+6, UTC+1
Reply | Threaded
Open this post in threaded view
|

Re: glClipPlanef not work in Java 11

yaqiang
Thanks a lot for your detailed reply! The solution of using the double variant can solve the problem in my laptop with Java 11. I am in bussiness trip that can not test it in my desktop, but I believe it should be working too.

The revised code:

        //Draw graphics
        float s = 1.01f;
        //gl.glClipPlanef(GL2.GL_CLIP_PLANE0, new float[]{1, 0, 0, s}, 0);
        gl.glClipPlane(GL2.GL_CLIP_PLANE0, new double[]{1, 0, 0, s}, 0);
        gl.glEnable(GL2.GL_CLIP_PLANE0);
        //gl.glClipPlanef(GL2.GL_CLIP_PLANE1, new float[]{-1, 0, 0, s}, 0);
        gl.glClipPlane(GL2.GL_CLIP_PLANE1, new double[]{-1, 0, 0, s}, 0);
        gl.glEnable(GL2.GL_CLIP_PLANE1);
        //gl.glClipPlanef(GL2.GL_CLIP_PLANE2, new float[]{0, -1, 0, s}, 0);
        gl.glClipPlane(GL2.GL_CLIP_PLANE2, new double[]{0, -1, 0, s}, 0);
        gl.glEnable(GL2.GL_CLIP_PLANE2);
        //gl.glClipPlanef(GL2.GL_CLIP_PLANE3, new float[]{0, 1, 0, s}, 0);
        gl.glClipPlane(GL2.GL_CLIP_PLANE3, new double[]{0, 1, 0, s}, 0);
        gl.glEnable(GL2.GL_CLIP_PLANE3);
        //gl.glClipPlanef(GL2.GL_CLIP_PLANE4, new float[]{0, 0, 1, s}, 0);
        gl.glClipPlane(GL2.GL_CLIP_PLANE4, new double[]{0, 0, 1, s}, 0);
        gl.glEnable(GL2.GL_CLIP_PLANE4);
        //gl.glClipPlanef(GL2.GL_CLIP_PLANE5, new float[]{0, 0, -1, s}, 0);
        gl.glClipPlane(GL2.GL_CLIP_PLANE5, new double[]{0, 0, -1, s}, 0);
        gl.glEnable(GL2.GL_CLIP_PLANE5);
        for (int m = 0; m < this.graphics.getNumGraphics(); m++) {
            Graphic graphic = this.graphics.get(m);
            drawGraphics(gl, graphic);
        }
        gl.glDisable(GL2.GL_CLIP_PLANE0);
        gl.glDisable(GL2.GL_CLIP_PLANE1);
        gl.glDisable(GL2.GL_CLIP_PLANE2);
        gl.glDisable(GL2.GL_CLIP_PLANE3);
        gl.glDisable(GL2.GL_CLIP_PLANE4);
        gl.glDisable(GL2.GL_CLIP_PLANE5);
Reply | Threaded
Open this post in threaded view
|

Re: glClipPlanef not work in Java 11

yaqiang
In reply to this post by Sven Gothel
Althrough the problem was solve by using the double variant, but I don't understand why double variant can do it while float variant can not?
Reply | Threaded
Open this post in threaded view
|

Re: glClipPlanef not work in Java 11

Sven Gothel
Administrator
On 10/8/19 4:19 AM, yaqiang [via jogamp] wrote:
> Althrough the problem was solve by using the double variant, but I don't
> understand why double variant can do it while float variant can not?

glClipPlanef is only implemented in your OpenGL driver,
if the extension support one of: GL_VERSION_ES_CM, GL_IMG_user_clip_plane,
GL_OES_single_precision extension.

That is what I tried to explain earlier.

/** Entry point to C language function: <code> void {@native
glClipPlanef}(GLenum plane, const GLfloat *  equation) </code> <br>Part of
<code>GL_VERSION_ES_CM</code>, <code>GL_IMG_user_clip_plane</code>,
<code>GL_OES_single_precision</code><br>Alias for:
<code>glClipPlanefIMG</code>, <code>glClipPlanefOES</code>
      @param equation a direct or array-backed {@link java.nio.FloatBuffer}   */
  public void glClipPlanef(int plane, FloatBuffer equation);

~Sven
Reply | Threaded
Open this post in threaded view
|

Re: glClipPlanef not work in Java 11

Sven Gothel
Administrator
In reply to this post by yaqiang
On 10/7/19 4:04 AM, yaqiang [via jogamp] wrote:
> I am developing an open source GIS and scientific computation software
> MeteoInfo (http://www.meteothink.org). Recently I add 3D plot functions using
> JOGL 2.3.2 (http://www.meteothink.org/news/meteoinfo_2.0.html). It works fine

yaqiang, I like to say congratulations to your great application of yours!

I like to add it to the JOGL application page.
Looks like a really nice scientific application,
very useful and it looks like one may want to extend it to all
kind of models and plotting?

Can one also use Java instead of Python for scripting
(including javac in the build)?

Neat neat.
Thank you & your team!

~Sven

Reply | Threaded
Open this post in threaded view
|

Re: glClipPlanef not work in Java 11

yaqiang
In reply to this post by Sven Gothel
Sven, thanks again for your patiently explain. JOGL is a great interface for Java programmer to use powerful opengl plotting functions.
Reply | Threaded
Open this post in threaded view
|

Re: glClipPlanef not work in Java 11

yaqiang
In reply to this post by Sven Gothel
Sven, I am so happy that you like MeteoInfo application and it's my honor that it could be added in JOGL application page. It's a general purpose scientific application although I prefer use it in meteorological field due to my working background.

It's pure Java application with Jython script engine. All computation and plotting functions are implemented using Java, and Jython package is developed for easy usage by users.
Reply | Threaded
Open this post in threaded view
|

Re: glClipPlanef not work in Java 11

Sven Gothel
Administrator
On 10/8/19 5:34 PM, yaqiang [via jogamp] wrote:
> Sven, I am so happy that you like MeteoInfo application and it's my honor that
> it could be added in JOGL application page. It's a general purpose scientific
> application although I prefer use it in meteorological field due to my working
> background.
Thank you and your team.

>
> It's pure Java application with Jython script engine. All computation and
> plotting functions are implemented using Java, and Jython package is developed
> for easy usage by users.

So it would be technically possible to add Java scripting in here right?
I.e. adding the javac module and compile the script 'online'.

But yes, I know, many script folks also like Python a lot.
Jython is compiling the Python scripts as well right?

~Sven
Reply | Threaded
Open this post in threaded view
|

Re: glClipPlanef not work in Java 11

yaqiang
> So it would be technically possible to add Java scripting in here right?
> I.e. adding the javac module and compile the script 'online'.

I have no experience on Java scripting through adding the javac module and complie the script 'online', but I think it's technically possible because MeteoInfo is pure Java software.

> But yes, I know, many script folks also like Python a lot.
> Jython is compiling the Python scripts as well right?

Jython can run Python scripts well, including Python standard library. But Jython can not run Python library with C extension API such as Numpy. So I developed some common used functions of Numpy, Matplotlib, Cartpy, Pandas in MeteoInfo using Java and Jython. The detailed description of MeteoInfo can be found in the paper ( https://openresearchsoftware.metajnl.com/articles/10.5334/jors.267/).
Reply | Threaded
Open this post in threaded view
|

Re: glClipPlanef not work in Java 11

gouessej
Administrator
By the way, why haven't you used Jzy3D to display charts?

Keep up the good work :)
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: glClipPlanef not work in Java 11

yaqiang
Jzy3D looks like a very powerful 3D plot library, but I can't find well done document online for usage of it. Another reason is my willing to learn JOGL. I will possible to use it in the future after I have basic knowlege of JOGL and could understand the code of Jzy3D.