How to Draw a Smooth Curve through a Set of 2D Points

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

How to Draw a Smooth Curve through a Set of 2D Points

mahesh
Is there any built in function in jogl to draw smooth bezier passing through N points ?
I searched in this forum, there was some discussion on nurbs but couldn't get any working example. I am using latest
jogamp-fat.jar.
Thanks
Reply | Threaded
Open this post in threaded view
|

Re: How to Draw a Smooth Curve through a Set of 2D Points

gouessej
Administrator
Hi

OpenGL supports NURBS and as JOGL is a binding of OpenGL, it supports NURBS too as I explained here (with some examples):
http://stackoverflow.com/questions/29243998/does-jogl-support-nurbs#29249905
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: How to Draw a Smooth Curve through a Set of 2D Points

mahesh
I am using jogl-fat.jar
But   it cant find class com.jogamp.opengl.util.GLUT
Also there is no such method glu.gluNewNurbsRenderer() in com.jogamp.opengl.glu.GLU instance glu

Reply | Threaded
Open this post in threaded view
|

Re: How to Draw a Smooth Curve through a Set of 2D Points

Xerxes Rånby
I assume you are using Tomas Hrasky's example code from 2007 contributed when he was a student at the University of Hradec Králové in the Czech Republic. Thomas example code is found in:
jogl-demos/src/demos/nurbs

The jogl-demos git have unfortunally not been updated to reflect the latest changes to jogl

I am using jogl-fat.jar
But   it gives error com.jogamp.opengl.util.GLUT

the class you are looking for have been move and is now found here:
import com.jogamp.opengl.util.gl2.GLUT
 
Also there is no such method glu.gluNewNurbsRenderer() in glu

Use the class
import com.jogamp.opengl.glu.gl2.GLUgl2
it contain the function gluNewNurbsRenderer()

If you update jogl-demos to use the above class imports please return a patch so that we can update jogl-demos to match the latest JogAmp JOGL release.

---

Inside the main JOGL source tree we also have the "graph" API that is what we consider the *best* way to render nurbs on all GPU's using a patent free shaders implementation.
Graph is suitable for both desktop and mobile GPU processors.

In a nutshell the JogAmp Graph API enable you to define nurbs shapes
Outline → OutlineShapes → GLRegion
and then render the shapes using a Renderer
RegionRenderer
TextRenderer (same as RegionRender with Helper methods for texts and fonts.)

outline.addVertex(x, y, z, w, onCurve);
outlineShape.addOutline(outline);
region = GLRegion.create(outlineShape, getRenderModes());
region.render(gl, outlineShape,...);


The best documentation for the graph API is found in the JOGL junit tests

and javadoc for Outline and OutlineShape .. and all classes i mentioned above..


Cheers
Xerxes
Reply | Threaded
Open this post in threaded view
|

Re: How to Draw a Smooth Curve through a Set of 2D Points

mahesh
This post was updated on .
Thanks Xerxes.
but now I cant find jogamp.opengl.io.StreamUtil
There may be many more to come. Where can I get demos updated to jogl 2.x?

Managed to get the demo working..

But still I cant figure out how to use graph api to render curve from set of 2d points.

Can you provide code snippet, please?

regards
Mahesh
Reply | Threaded
Open this post in threaded view
|

Re: How to Draw a Smooth Curve through a Set of 2D Points

Xerxes Rånby
mahesh wrote
Thanks Xerxes.
but now I cant find jogamp.opengl.io.StreamUtil
StreamUtil was removed from JOGL before the first 2.x release in 2011 and got replaced by the more generic IOUtil found in Gluegen.

Thus if you have code containing
byte[] data = StreamUtil.readAll2Array(stream);

Then you can replace this with:
import com.jogamp.common.util.IOUtil;
byte[] data = IOUtil.copyStream2ByteArray(stream);

mahesh wrote
There may be many more to come. Where can I get demos updated to jogl 2.x?
The best demo example are the junit tests found inside the jogl/src/test path of the jogl git where we store all reference code how each api in JogAmp JOGL is to be used and tested.
Each JogAmp release is only tested against the junit tests.

The jogl-demos git contain end user submitted example code, however there is no guarantee that all examples still work, however we of course want people to be able to use the examples in jogl-demos thus we welcome contributors to clean up the jogl-demos git to work with the latest JogAmp jogl release.
Reply | Threaded
Open this post in threaded view
|

Re: How to Draw a Smooth Curve through a Set of 2D Points

mahesh
Thanks once again for prompt reply..

Managed to get the demo working!!

But still I cant figure out how to use graph api to render curve from set of 2d points.

Can you provide code snippet, please?

regards
Mahesh
Reply | Threaded
Open this post in threaded view
|

Re: How to Draw a Smooth Curve through a Set of 2D Points

Xerxes Rånby
This post was updated on .
I have made a one class file that you can quickly compile and run to test the JogAmp Graph API to render filled NURBS curves using the GPU from a set of 2d points.

You can use this online tool and webpage to understand better how NURBS relate to Bezier curves
http://nurbscalculator.in/
Bezier is really only a special case of NURBS curves thus the example below is a highly optimized high performance solution to your problem.
I want to point out that the JogAmp Graph solution below will render mathematically perfect aliased curves in all resolutions without having to cheat by dividing the curve into many smaller segments.

The red shape is created dynamically for each frame while the white shapes are only created once at initialization. All shapes can be positioned in 3d space by changing the PMVMatrix.

The example code below will use ~10Mb of GPU memory and CPU usage will stay around 1-2% when running fullscreen with butter smooth frame-rate across 3 monitors.

package com.gudinna;

import com.jogamp.graph.curve.OutlineShape;
import com.jogamp.graph.curve.Region;
import com.jogamp.graph.curve.opengl.GLRegion;
import com.jogamp.graph.curve.opengl.RegionRenderer;
import com.jogamp.graph.curve.opengl.RenderState;
import com.jogamp.graph.geom.SVertex;

import com.jogamp.newt.opengl.GLWindow;

import com.jogamp.opengl.*;
import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.util.PMVMatrix;

/**
 * <pre>
 *   __ __|_  ___________________________________________________________________________  ___|__ __
 *  //    /\                                           _                                  /\    \\
 * //____/  \__     __ _____ _____ _____ _____ _____  | |     __ _____ _____ __        __/  \____\\
 *  \    \  / /  __|  |     |   __|  _  |     |  _  | | |  __|  |     |   __|  |      /\ \  /    /
 *   \____\/_/  |  |  |  |  |  |  |     | | | |   __| | | |  |  |  |  |  |  |  |__   "  \_\/____/
 *  /\    \     |_____|_____|_____|__|__|_|_|_|__|    | | |_____|_____|_____|_____|  _  /    /\
 * /  \____\                       http://jogamp.org  |_|                              /____/  \
 * \  /   "' _________________________________________________________________________ `"   \  /
 *  \/____.                                                                             .____\/
 * </pre>
 *
 * <p>
 * JogAmp JOGL OpenGL ES 2 graph nurbs demo to expose and learn how to use the graph API to draw nurbs.
 *
 * Inside the main JOGL source tree we have the "graph" API that is what we consider the *best* way to render nurbs on all GPU's using a patent free shaders implementation.
 * Graph is suitable for both desktop and mobile GPU processors.
 *
 * In a nutshell the JogAmp Graph API enable you to define nurbs shapes
 * Outline → OutlineShapes → GLRegion
 * and then render the shapes using a Renderer
 * RegionRenderer
 * TextRenderer (same as RegionRender with Helper methods for texts and fonts.)
 *
 * outline.addVertex(x, y, z, w, onCurve);
 * outlineShape.addOutline(outline);
 * region = GLRegion.create(outlineShape, getRenderModes());
 * region.render(gl, outlineShape,...);
 *
 * The graph API is using the math by Rami Santina introduced in 2011
 * https://jogamp.org/doc/gpunurbs2011/p70-santina.pdf
 * https://jogamp.org/doc/gpunurbs2011/graphicon2011-slides.pdf
 *
 * The best documentation for the graph API is found in the JOGL junit tests
 * http://jogamp.org/git/?p=jogl.git;a=tree;f=src/test/com/jogamp/opengl/test/junit/graph;hb=HEAD
 *
 * and javadoc for Outline and OutlineShape .. and all classes i mentioned above..
 * https://www.jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/graph/geom/Outline.html
 * https://www.jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/graph/curve/OutlineShape.html
 * </p>
 *
 * @author Xerxes Rånby (xranby)
 */

public class JogAmpGraphAPINurbsDemo {

    static Animator animator;

    public static void main(String[] args) {

        // Enable JOGL debugging of GLSL shader compilation and GL calls
        System.setProperty( "jogl.debug.GLSLCode", "");
        System.setProperty( "jogl.debug.DebugGL", "");

        GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2ES2));
        caps.setAlphaBits(4);
	    GLWindow glWindow = GLWindow.create(caps);
        glWindow.setSize(800,400);
        glWindow.setTitle("JogAmp JOGL Graph API nurbs demo");
        glWindow.setVisible(true);

        glWindow.addGLEventListener(new GraphNurbs() /* GLEventListener */);

        animator = new Animator();
        animator.add(glWindow);
        animator.start();
    }

    private static class GraphNurbs implements GLEventListener{

        // these will define a shape that is defined once at init
        OutlineShape outlineShape;
        RenderState renderState;
        RegionRenderer regionRenderer;
        GLRegion glRegion;

        // these will define a shape that is updated dynamically for each frame
        OutlineShape dynamicOutlineShape;
        RenderState dynamicRenderState;
        RegionRenderer dynamicRegionRenderer;
        GLRegion dynamicGlRegion;

        volatile float weight = 1.0f;

        final float zNear = 0.1f, zFar = 7000f;

        /* 2nd pass texture size antialias SampleCount
           4 is usually enough */
        private final int[] sampleCount = new int[] { 4 };

        /* variables used to update the PMVMatrix before rendering */
        private float xTranslate = -40f;
        private float yTranslate =  0f;
        private float zTranslate = -100f;
        private float angleRotate = 0f;

        private final int renderModes = Region.VARWEIGHT_RENDERING_BIT;

        @Override
        public void init(GLAutoDrawable drawable) {

            final GL2ES2 gl = drawable.getGL().getGL2ES2();
            gl.setSwapInterval(1);
            gl.glEnable(GL.GL_DEPTH_TEST);
            gl.glEnable(GL.GL_BLEND);
            gl.glClearColor(1.0f, 0.0f, 1.0f, 1.0f);

             /* initialize OpenGL specific classes that know how to render the graph API shapes */
            renderState = RenderState.createRenderState(SVertex.factory());
            // define a colour to render our shape with
            renderState.setColorStatic(1.0f, 1.0f, 1.0f, 1.0f);
            renderState.setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED);

            /* use the generic graph API to define a shape
             * we use the renderState getVertexFactory
             * to automatically store all vertex data on the GPU
             **/
            outlineShape = new OutlineShape(renderState.getVertexFactory());

            // Here i add some points off curve causing nurbs bends
            outlineShape.addEmptyOutline();
            outlineShape.addVertex(0.0f,-10.0f, true);
            outlineShape.addVertex(17.0f,-10.0f, true);
            outlineShape.addVertex(11.0f,5.0f, /* onCurve */false);
            outlineShape.addVertex(17.0f,10.0f, true);
            outlineShape.addVertex(7.0f,15.0f, /* onCurve */ false);
            outlineShape.addVertex(6.0f,8.0f, /* onCurve */false);
            outlineShape.addVertex(0.0f,10.0f,true);
            outlineShape.closeLastOutline(true);

            // Here i add all points on curve == straight lines
            float offset = 30;
            outlineShape.addEmptyOutline();
            outlineShape.addVertex(offset+0.0f,-10.0f, true);
            outlineShape.addVertex(offset+17.0f,-10.0f, true);
            outlineShape.addVertex(offset+11.0f,5.0f, true);
            outlineShape.addVertex(offset+16.0f,10.0f, true);
            outlineShape.addVertex(offset+7.0f,15.0f, true);
            outlineShape.addVertex(offset+6.0f,8.0f, true);
            outlineShape.addVertex(offset+0.0f,10.0f, true);
            outlineShape.closeLastOutline(true);

            regionRenderer = RegionRenderer.create(renderState, /* GLCallback */ RegionRenderer.defaultBlendEnable, /* GLCallback */ RegionRenderer.defaultBlendDisable);

            glRegion = GLRegion.create(/* RenderModes */ renderModes, /* TextureSequence */ null);
            glRegion.addOutlineShape(outlineShape, null, glRegion.hasColorChannel() ? renderState.getColorStatic(new float[4]) : null);


            /* initialize OpenGL specific classes that know how to render the graph API shapes */
            dynamicRenderState = RenderState.createRenderState(SVertex.factory());
            // define a RED colour to render our shape with
            dynamicRenderState.setColorStatic(1.0f, 0.0f, 0.0f, 1.0f);
            dynamicRenderState.setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED);

            dynamicRegionRenderer = RegionRenderer.create(dynamicRenderState, /* GLCallback */ RegionRenderer.defaultBlendEnable, /* GLCallback */ RegionRenderer.defaultBlendDisable);

            // we will fill the OutlineShape dynamically in display
            dynamicOutlineShape = new OutlineShape(dynamicRenderState.getVertexFactory());

            dynamicGlRegion = GLRegion.create(/* RenderModes */ renderModes, /* TextureSequence */ null);

        }

        @Override
        public void dispose(GLAutoDrawable drawable) {
            final GL2ES2 gl = drawable.getGL().getGL2ES2();
            //stop the animator thread when user close the window
            animator.stop();
            // it is important to free memory allocated no the GPU!
            // this memory cant be garbage collected by the JVM
            regionRenderer.destroy(gl);
            glRegion.destroy(gl);
            dynamicGlRegion.destroy(gl);
        }

        @Override
        public void display(GLAutoDrawable drawable) {
            final GL2ES2 gl = drawable.getGL().getGL2ES2();

            // use JogAmp high resolution timer for smooth animations!
            double time = com.jogamp.common.os.Platform.currentTimeMicros();
            float sinusAnimation = (float) (Math.sin(time/100000f));
            float sinusAnimationRotate = (float) (Math.sin(time/1000000f));

            // clear screen
            gl.glClearColor(0.2f, 0.2f, 0.2f, 1.0f);
            gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);

            // the RegionRenderer PMVMatrix define where we want to render our shape
            final PMVMatrix pmv = regionRenderer.getMatrix();
            pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
            pmv.glLoadIdentity();
            pmv.glTranslatef(xTranslate, yTranslate, zTranslate);
            pmv.glRotatef(angleRotate+ 10f * sinusAnimationRotate, 0, 0, 1);

            if( weight != regionRenderer.getRenderState().getWeight() ) {
                regionRenderer.getRenderState().setWeight(weight);
            }

            // Draw the static shape using RegionRenderer and GLRegion
            regionRenderer.enable(gl, true);
            glRegion.draw(gl, regionRenderer, sampleCount);
            regionRenderer.enable(gl, false);


            float offset = 60;

            // We will now update the dynamic shape that changes on each frame
            // I will animate the off curve points
            dynamicOutlineShape.clear();
            dynamicOutlineShape.addVertex(offset + 0.0f,-10.0f, true);
            dynamicOutlineShape.addVertex(offset + 17.0f,-10.0f, true);
            dynamicOutlineShape.addVertex(offset + 11.0f +5 * sinusAnimation,5.0f + 5 * sinusAnimation, /* onCurve */false);
            dynamicOutlineShape.addVertex(offset + 17.0f,10.0f, true);
            dynamicOutlineShape.addVertex(offset + 7.0f + 5 * sinusAnimation,15.0f + 5 * sinusAnimation, /* onCurve */ false);
            dynamicOutlineShape.addVertex(offset + 6.0f ,8.0f , true);
            dynamicOutlineShape.addVertex(offset + 0.0f,10.0f, true);
            dynamicOutlineShape.closeLastOutline(true);

            // the RegionRenderer PMVMatrix define where we want to render our shape
            final PMVMatrix dynamicPmv = dynamicRegionRenderer.getMatrix();
            dynamicPmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
            dynamicPmv.glLoadIdentity();
            dynamicPmv.glTranslatef(xTranslate, yTranslate, zTranslate);
            dynamicPmv.glRotatef(angleRotate+ 10f * sinusAnimationRotate, 0, 0, 1);

            if( weight != dynamicRegionRenderer.getRenderState().getWeight() ) {
                dynamicRegionRenderer.getRenderState().setWeight(weight);
            }

            // when changing the OutlineShape dynamically it is very important that you clear the GPU from old data
            dynamicGlRegion.clear(gl);
            // here we upload the new dynamically created data to the GPU
            dynamicGlRegion.addOutlineShape(dynamicOutlineShape, null, glRegion.hasColorChannel() ? renderState.getColorStatic(new float[4]) : null);

             // Draw the dynamic shape using RegionRenderer and GLRegion
            dynamicRegionRenderer.enable(gl, true);
            dynamicGlRegion.draw(gl, dynamicRegionRenderer, sampleCount);
            dynamicRegionRenderer.enable(gl, false);
        }

        @Override
        public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
            final PMVMatrix pmv = regionRenderer.getMatrix();
            regionRenderer.reshapePerspective(45.0f, width, height, zNear, zFar);
            pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
            pmv.glLoadIdentity();

            final PMVMatrix dynamicPmv = dynamicRegionRenderer.getMatrix();
            dynamicRegionRenderer.reshapePerspective(45.0f, width, height, zNear, zFar);
            dynamicPmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
            dynamicPmv.glLoadIdentity();
        }
    }
}
Reply | Threaded
Open this post in threaded view
|

Re: How to Draw a Smooth Curve through a Set of 2D Points

gouessej
Administrator
In reply to this post by mahesh
Thank you Xerxes for the excellent example.

mahesh, when you don't find a class because it has been moved, you can look at it in our API documentation here:
http://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/

GLUT is here:
http://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/opengl/util/gl2/GLUT.html
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: How to Draw a Smooth Curve through a Set of 2D Points

mahesh
In reply to this post by Xerxes Rånby
Thankyou very much for the code..
But when i run the code in eclipse(with latest jogl-fat.jar) it does't display anything (neither it gives any error except red coloured info shown in the image below).



BTW how to create control points automatically for smooth spline through set of N points (all are on curve).

Actually I am working on 2D physics simulator, where I want to display position/speed time graph for object by collecting values over regular interval of time (roughly 60 times a second). To make this curve smooth and fast I an thinking of spline.
Also I need to recreate curve every frame (or just pop and push new data obtained in new frame).

Any suggestion??
Regards
mahesh


Reply | Threaded
Open this post in threaded view
|

Re: How to Draw a Smooth Curve through a Set of 2D Points

Xerxes Rånby
This post was updated on .
Can you run the com.jogamp.newt.opengl.GLWindow class it will list what
OpenGL driver is in use on your windows system.
java -cp jogamp-fat.jar com.jogamp.newt.opengl.GLWindow

On my linux system it looks like this
-----------------------------------------------------------------------------------------------------
X11GraphicsDevice[type .x11, connection :0]: 
	Natives
		GL4bc 	true [4.5 (Compat profile, arb, compat[ES2, ES3, ES31, ES32], FBO, hardware)]
		GL4 	true [4.5 (Core profile, arb, compat[ES2, ES3, ES31, ES32], FBO, hardware)]
		GLES3 	true [3.2 (ES profile, arb, compat[ES2, ES3, ES31, ES32], FBO, hardware)]
		GL3bc 	true [4.5 (Compat profile, arb, compat[ES2, ES3, ES31, ES32], FBO, hardware)]
		GL3 	true [4.5 (Core profile, arb, compat[ES2, ES3, ES31, ES32], FBO, hardware)]
		GL2 	true [4.5 (Compat profile, arb, compat[ES2, ES3, ES31, ES32], FBO, hardware)]
		GLES2 	true [3.2 (ES profile, arb, compat[ES2, ES3, ES31, ES32], FBO, hardware)]
		GLES1 	true [1.1 (ES profile, arb, compat[FP32], hardware)]
		Count	8 / 8
	Common
		GL4ES3 	true
		GL2GL3 	true
		GL2ES2 	true
		GL2ES1 	true
	Mappings
		GL3bc 	GLProfile[GL3bc/GL4bc.hw]
		GL2 	GLProfile[GL2/GL4bc.hw]
		GLES3 	GLProfile[GLES3/GLES3.hw]
		GL4 	GLProfile[GL4/GL4.hw]
		GL3 	GLProfile[GL3/GL4.hw]
		GL2GL3 	GLProfile[GL2GL3/GL4bc.hw]
		GLES1 	GLProfile[GLES1/GLES1.hw]
		GLES2 	GLProfile[GLES2/GLES3.hw]
		GL2ES1 	GLProfile[GL2ES1/GL4bc.hw]
		GL4ES3 	GLProfile[GL4ES3/GL4.hw]
		GL2ES2 	GLProfile[GL2ES2/GL4.hw]
		GL4bc 	GLProfile[GL4bc/GL4bc.hw]
		default GLProfile[GL4bc/GL4bc.hw]
		Count	12 / 12

Swap Interval  1
GL Profile     GLProfile[GL4bc/GL4bc.hw]
GL Version     4.5 (Compat profile, arb, compat[ES2, ES3, ES31, ES32], FBO, hardware) - 4.5.0 NVIDIA 367.57 [GL 4.5.0, vendor 367.57.0 (NVIDIA 367.57)]
Quirks         [NoSurfacelessCtx]
Impl. class    jogamp.opengl.gl4.GL4bcImpl
GL_VENDOR      NVIDIA Corporation
GL_RENDERER    GeForce GTX 580/PCIe/SSE2
GL_VERSION     4.5.0 NVIDIA 367.57
GLSL           true, has-compiler-func: true, version: 4.50 NVIDIA / 4.50.0
GL FBO: basic true, full true
GL_EXTENSIONS  315
GLX_EXTENSIONS 34
-----------------------------------------------------------------------------------------------------
Requested: GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]]
Chosen   : GLCaps[glx vid 0x27, fbc 0x10d: rgba 8/8/8/0, opaque, accum-rgba 16/16/16/16, dp/st/ms 24/0/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]]
GL impl. class jogamp.opengl.gl4.GL4bcImpl
GL4ES3 retrieved, impl. class jogamp.opengl.gl4.GL4bcImpl
GL3 retrieved, impl. class jogamp.opengl.gl4.GL4bcImpl

2017-03-01 4:54 GMT+01:00 mahesh [via jogamp] <
ml-node+s762907n4037691h84@n3.nabble.com>:

> Thankyou very much for the code..
> But when i run the code in eclipse(with latest jogl-fat.jar) it does't
> display anything (neither it gives any error except red coloured info shown
> in the image below).

I suspect that you are using an OpenGL driver that do not support shaders or the shaders have ailed to compile for some reason.
It is common for people with Intel graphics cards to have to install an OpenGL driver manually from Intel's homepage in order to get modern OpenGL support. Windows only ship with old OpenGL drivers that only support the fixed function pipeline and all shader based code will not work using Microsofts OpenGL driver.


> BTW how to create control points automatically for smooth spline through
> set of N points (all are on curve).

If you have all N points on curve for nurbs then it will be no bends.
If you have even points on curve and odd points off curve then you will get something more towards what you want.

> Actually I am working on 2D physics simulator, where I want to display
> position/speed time graph for object by collecting values over regular
> interval of time (roughly 60 times a second). To make this curve smooth and
> fast I an thinking of spline.

If you have a lot of datapoints then you can consider using a vertex buffer
https://wadeawalker.wordpress.com/2010/10/17/tutorial-faster-rendering-with-vertex-buffer-objects/

> Also I need to recreate curve every frame (or just pop and push new data
> obtained in new frame).
>
> Any suggestion??
> Regards
> mahesh
Reply | Threaded
Open this post in threaded view
|

Re: How to Draw a Smooth Curve through a Set of 2D Points

mahesh
Hi Xerxes,
OpenGl driver are available and my jogl app is running fine, Even curveApp in jogl demo is running fine, but still code example you provided cant display anything.

output :
WindowsGraphicsDevice[type .windows, connection decon]:
        Natives
                GL4bc true [4.3 (Compat profile, arb, compat[ES2, ES3], FBO, hardware)]
                GL4 true [4.3 (Core profile, arb, compat[ES2, ES3], FBO, hardware)]
                GLES3 false
                GL3bc true [4.3 (Compat profile, arb, compat[ES2, ES3], FBO, hardware)]
                GL3 true [4.3 (Core profile, arb, compat[ES2, ES3], FBO, hardware)]
                GL2 true [4.3 (Compat profile, arb, compat[ES2, ES3], FBO, hardware)]
                GLES2 false
                GLES1 false
                Count 5 / 8
        Common
                GL4ES3 true
                GL2GL3 true
                GL2ES2 true
                GL2ES1 true
        Mappings
                GL2ES2 GLProfile[GL2ES2/GL4.hw]
                GL2ES1 GLProfile[GL2ES1/GL4bc.hw]
                GL2 GLProfile[GL2/GL4bc.hw]
                GL4 GLProfile[GL4/GL4.hw]
                GL4bc GLProfile[GL4bc/GL4bc.hw]
                GL3 GLProfile[GL3/GL4.hw]
                GL4ES3 GLProfile[GL4ES3/GL4.hw]
                GL2GL3 GLProfile[GL2GL3/GL4bc.hw]
                GL3bc GLProfile[GL3bc/GL4bc.hw]
                default GLProfile[GL4bc/GL4bc.hw]
                Count 9 / 12
Reply | Threaded
Open this post in threaded view
|

Re: How to Draw a Smooth Curve through a Set of 2D Points

Xerxes Rånby
can you list the last part that show the OpenGL vendor.. I cant explain why the code I posted do not work on your card since it is mostly based on the junit test, unless i made a silly error when moving the code into one class,  the code is using shaders that we have tested on all platforms available to the JogAmp jogl buildfarm.

please post the full log or at least the last part similar to what is seen below:

Swap Interval  1
GL Profile     GLProfile[GL4bc/GL4bc.hw]
GL Version     4.5 (Compat profile, arb, compat[ES2, ES3, ES31, ES32], FBO, hardware) - 4.5.0 NVIDIA 367.57 [GL 4.5.0, vendor 367.57.0 (NVIDIA 367.57)]
Quirks         [NoSurfacelessCtx]
Impl. class    jogamp.opengl.gl4.GL4bcImpl
GL_VENDOR      NVIDIA Corporation
GL_RENDERER    GeForce GTX 580/PCIe/SSE2
GL_VERSION     4.5.0 NVIDIA 367.57
GLSL           true, has-compiler-func: true, version: 4.50 NVIDIA / 4.50.0
GL FBO: basic true, full true
GL_EXTENSIONS  315
GLX_EXTENSIONS 34
-----------------------------------------------------------------------------------------------------
Requested: GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]]
Chosen   : GLCaps[glx vid 0x27, fbc 0x10d: rgba 8/8/8/0, opaque, accum-rgba 16/16/16/16, dp/st/ms 24/0/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]]
GL impl. class jogamp.opengl.gl4.GL4bcImpl
GL4ES3 retrieved, impl. class jogamp.opengl.gl4.GL4bcImpl
GL3 retrieved, impl. class jogamp.opengl.gl4.GL4bcImpl
Reply | Threaded
Open this post in threaded view
|

Re: How to Draw a Smooth Curve through a Set of 2D Points

mahesh
forceES2    false
forceES3    false
forceGL3    false
forceGL4ES3 false
-----------------------------------------------------------------------------------------------------
Platform: WINDOWS / Windows 7 6.1 (6.1.0), x86 (X86_32, GENERIC_ABI), 4 cores, littleEndian true
MachineDataInfo: runtimeValidated true, 32Bit true, primitive size / alignment:
  int8    1 / 1, int16   2 / 2
  int     4 / 4, long    4 / 4
  int32   4 / 4, int64   8 / 8
  float   4 / 4, double  8 / 8, ldouble 12 / 4
  pointer 4 / 4, page    4096
Platform: Java Version: 1.7.0_79 (1.7.0u79), VM: Java HotSpot(TM) Client VM, Runtime: Java(TM) SE Runtime Environment
Platform: Java Vendor: Oracle Corporation, http://java.oracle.com/, JavaSE: true, Java6: true, AWT enabled: true
-----------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------
Package: com.jogamp
Extension Name: com.jogamp
Specification Title: JogAmp Java Bindings Specification
Specification Vendor: JogAmp Community
Specification Version: 2.3
Implementation Title: JogAmp Java Bindings Fat Jar
Implementation Vendor: JogAmp Community
Implementation Vendor ID: com.jogamp
Implementation URL: http://jogamp.org/
Implementation Version: 2.3.2
Implementation Build: 2.3-b900-20151009
Implementation Branch: origin/master
Implementation Commit: cc1e9bc698b7f11097c1e114027e53121552f280
-----------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------
Package: com.jogamp
Extension Name: com.jogamp
Specification Title: JogAmp Java Bindings Specification
Specification Vendor: JogAmp Community
Specification Version: 2.3
Implementation Title: JogAmp Java Bindings Fat Jar
Implementation Vendor: JogAmp Community
Implementation Vendor ID: com.jogamp
Implementation URL: http://jogamp.org/
Implementation Version: 2.3.2
Implementation Build: 2.3-b900-20151009
Implementation Branch: origin/master
Implementation Commit: cc1e9bc698b7f11097c1e114027e53121552f280
-----------------------------------------------------------------------------------------------------
GLProfiles on device WindowsGraphicsDevice[type .windows, connection decon, unitID 0, handle 0x0, owner false, NullToolkitLock[obj 0x14f4ec4]]
        Natives
                GL4bc true [4.3 (Compat profile, arb, compat[ES2, ES3], FBO, hardware)]
                GL4 true [4.3 (Core profile, arb, compat[ES2, ES3], FBO, hardware)]
                GLES3 false
                GL3bc true [4.3 (Compat profile, arb, compat[ES2, ES3], FBO, hardware)]
                GL3 true [4.3 (Core profile, arb, compat[ES2, ES3], FBO, hardware)]
                GL2 true [4.3 (Compat profile, arb, compat[ES2, ES3], FBO, hardware)]
                GLES2 false
                GLES1 false
                Count 5 / 8
        Common
                GL4ES3 true
                GL2GL3 true
                GL2ES2 true
                GL2ES1 true
        Mappings
                GL2ES2 GLProfile[GL2ES2/GL4.hw]
                GL2ES1 GLProfile[GL2ES1/GL4bc.hw]
                GL2 GLProfile[GL2/GL4bc.hw]
                GL4 GLProfile[GL4/GL4.hw]
                GL4bc GLProfile[GL4bc/GL4bc.hw]
                GL3 GLProfile[GL3/GL4.hw]
                GL4ES3 GLProfile[GL4ES3/GL4.hw]
                GL2GL3 GLProfile[GL2GL3/GL4bc.hw]
                GL3bc GLProfile[GL3bc/GL4bc.hw]
                default GLProfile[GL4bc/GL4bc.hw]
                Count 9 / 12


Desktop Capabilities:
        GLCaps[wgl vid 1 arb: rgba 8/8/8/8, opaque, accum-rgba 0/0/0/0, dp/st/ms 0/0/0, one, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo, pbuffer]]
        GLCaps[wgl vid 2 arb: rgba 8/8/8/8, opaque, accum-rgba 16/16/16/16, dp/st/ms 0/0/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo, pbuffer]]
        GLCaps[wgl vid 3 arb: rgba 8/8/8/8, opaque, accum-rgba 16/16/16/16, dp/st/ms 24/8/0, one, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo, pbuffer]]
        GLCaps[wgl vid 4 arb: rgba 8/8/8/8, opaque, accum-rgba 0/0/0/0, dp/st/ms 24/8/0, one, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo, pbuffer]]
        GLCaps[wgl vid 5 arb: rgba 8/8/8/8, opaque, accum-rgba 16/16/16/16, dp/st/ms 24/8/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo, pbuffer]]
        GLCaps[wgl vid 6 arb: rgba 8/8/8/8, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, one, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo, pbuffer]]
        GLCaps[wgl vid 7 arb: rgba 8/8/8/8, opaque, accum-rgba 16/16/16/16, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo, pbuffer]]
        GLCaps[wgl vid 8 arb: rgba 8/8/8/8, opaque, accum-rgba 16/16/16/16, dp/st/ms 0/0/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo, pbuffer]]
        GLCaps[wgl vid 9 arb: rgba 8/8/8/8, opaque, accum-rgba 16/16/16/16, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo, pbuffer]]
        GLCaps[wgl vid 10 arb: rgba 8/8/8/8, opaque, accum-rgba 16/16/16/16, dp/st/ms 24/8/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo, pbuffer]]
        GLCaps[wgl vid 11 arb: rgba 8/8/8/8, opaque, accum-rgba 0/0/0/0, dp/st/ms 0/0/4, sample-ext default, one, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo, pbuffer]]
        GLCaps[wgl vid 12 arb: rgba 8/8/8/8, opaque, accum-rgba 16/16/16/16, dp/st/ms 0/0/4, sample-ext default, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo, pbuffer]]
        GLCaps[wgl vid 13 arb: rgba 8/8/8/8, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/4, sample-ext default, one, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo, pbuffer]]
        GLCaps[wgl vid 14 arb: rgba 8/8/8/8, opaque, accum-rgba 16/16/16/16, dp/st/ms 16/0/4, sample-ext default, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo, pbuffer]]
        GLCaps[wgl vid 15 arb: rgba 8/8/8/8, opaque, accum-rgba 0/0/0/0, dp/st/ms 24/8/4, sample-ext default, one, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo, pbuffer]]
        GLCaps[wgl vid 16 arb: rgba 8/8/8/8, opaque, accum-rgba 16/16/16/16, dp/st/ms 24/8/4, sample-ext default, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo, pbuffer]]
        GLCaps[wgl vid 17 arb: rgba 8/8/8/8, opaque, accum-rgba 0/0/0/0, dp/st/ms 0/0/4, sample-ext default, one, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo, pbuffer]]
        GLCaps[wgl vid 18 arb: rgba 8/8/8/8, opaque, accum-rgba 16/16/16/16, dp/st/ms 0/0/4, sample-ext default, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo, pbuffer]]
        GLCaps[wgl vid 19 arb: rgba 8/8/8/8, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/4, sample-ext default, one, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo, pbuffer]]
        GLCaps[wgl vid 20 arb: rgba 8/8/8/8, opaque, accum-rgba 16/16/16/16, dp/st/ms 16/0/4, sample-ext default, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo, pbuffer]]
        GLCaps[wgl vid 21 arb: rgba 8/8/8/8, opaque, accum-rgba 0/0/0/0, dp/st/ms 24/8/4, sample-ext default, one, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo, pbuffer]]
        GLCaps[wgl vid 22 arb: rgba 8/8/8/8, opaque, accum-rgba 16/16/16/16, dp/st/ms 24/8/4, sample-ext default, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo, pbuffer]]
        GLCaps[wgl vid 23 arb: rgba 8/8/8/8, opaque, accum-rgba 16/16/16/16, dp/st/ms 24/8/4, sample-ext default, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo, pbuffer]]
        GLCaps[wgl vid 24 arb: rgba 8/8/8/8, opaque, accum-rgba 0/0/0/0, dp/st/ms 0/0/8, sample-ext default, one, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo, pbuffer]]
        GLCaps[wgl vid 25 arb: rgba 8/8/8/8, opaque, accum-rgba 16/16/16/16, dp/st/ms 0/0/8, sample-ext default, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo, pbuffer]]
        GLCaps[wgl vid 26 arb: rgba 8/8/8/8, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/8, sample-ext default, one, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo, pbuffer]]
        GLCaps[wgl vid 27 arb: rgba 8/8/8/8, opaque, accum-rgba 16/16/16/16, dp/st/ms 16/0/8, sample-ext default, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo, pbuffer]]
        GLCaps[wgl vid 28 arb: rgba 8/8/8/8, opaque, accum-rgba 0/0/0/0, dp/st/ms 24/8/8, sample-ext default, one, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo, pbuffer]]
        GLCaps[wgl vid 29 arb: rgba 8/8/8/8, opaque, accum-rgba 16/16/16/16, dp/st/ms 24/8/8, sample-ext default, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo, pbuffer]]
        GLCaps[wgl vid 30 arb: rgba 8/8/8/8, opaque, accum-rgba 0/0/0/0, dp/st/ms 0/0/8, sample-ext default, one, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo, pbuffer]]
        GLCaps[wgl vid 31 arb: rgba 8/8/8/8, opaque, accum-rgba 16/16/16/16, dp/st/ms 0/0/8, sample-ext default, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo, pbuffer]]
        GLCaps[wgl vid 32 arb: rgba 8/8/8/8, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/8, sample-ext default, one, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo, pbuffer]]
        GLCaps[wgl vid 33 arb: rgba 8/8/8/8, opaque, accum-rgba 16/16/16/16, dp/st/ms 16/0/8, sample-ext default, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo, pbuffer]]
        GLCaps[wgl vid 34 arb: rgba 8/8/8/8, opaque, accum-rgba 0/0/0/0, dp/st/ms 24/8/8, sample-ext default, one, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo, pbuffer]]
        GLCaps[wgl vid 35 arb: rgba 8/8/8/8, opaque, accum-rgba 16/16/16/16, dp/st/ms 24/8/8, sample-ext default, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo, pbuffer]]
        GLCaps[wgl vid 36 arb: rgba 8/8/8/0, opaque, accum-rgba 16/16/16/0, dp/st/ms 32/8/0, one, mono  , sw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo]]
        GLCaps[wgl vid 37 arb: rgba 8/8/8/0, opaque, accum-rgba 16/16/16/0, dp/st/ms 16/8/0, one, mono  , sw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo]]
        GLCaps[wgl vid 38 arb: rgba 8/8/8/0, opaque, accum-rgba 16/16/16/0, dp/st/ms 32/8/0, dbl, mono  , sw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo]]
        GLCaps[wgl vid 39 arb: rgba 8/8/8/0, opaque, accum-rgba 16/16/16/0, dp/st/ms 16/8/0, dbl, mono  , sw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo]]
        GLCaps[wgl vid 40 arb: rgba 8/8/8/8, opaque, accum-rgba 16/16/16/16, dp/st/ms 32/8/0, one, mono  , sw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo]]
        GLCaps[wgl vid 41 arb: rgba 8/8/8/8, opaque, accum-rgba 16/16/16/16, dp/st/ms 16/8/0, one, mono  , sw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo]]
        GLCaps[wgl vid 42 arb: rgba 8/8/8/8, opaque, accum-rgba 16/16/16/16, dp/st/ms 32/8/0, dbl, mono  , sw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo]]
        GLCaps[wgl vid 43 arb: rgba 8/8/8/8, opaque, accum-rgba 16/16/16/16, dp/st/ms 16/8/0, dbl, mono  , sw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo]]
        GLCaps[wgl vid 44 arb: rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 32/8/0, one, mono  , sw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo]]
        GLCaps[wgl vid 45 arb: rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/8/0, one, mono  , sw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo]]
        GLCaps[wgl vid 46 arb: rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 32/8/0, dbl, mono  , sw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo]]
        GLCaps[wgl vid 47 arb: rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/8/0, dbl, mono  , sw, GLProfile[GL4bc/GL4bc.hw], on-scr[fbo]]
        GLCaps[wgl vid 48 gdi: rgba 8/8/8/0, opaque, accum-rgba 16/16/16/0, dp/st/ms 32/8/0, one, mono  , sw, GLProfile[GL4bc/GL4bc.hw], offscr[bitmap]]
        GLCaps[wgl vid 49 gdi: rgba 8/8/8/0, opaque, accum-rgba 16/16/16/0, dp/st/ms 16/8/0, one, mono  , sw, GLProfile[GL4bc/GL4bc.hw], offscr[bitmap]]
        GLCaps[wgl vid 52 gdi: rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 32/8/0, one, mono  , sw, GLProfile[GL4bc/GL4bc.hw], offscr[bitmap]]
        GLCaps[wgl vid 53 gdi: rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/8/0, one, mono  , sw, GLProfile[GL4bc/GL4bc.hw], offscr[bitmap]]
        GLCaps[wgl vid 72 arb: rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 0/0/0, one, mono  , hw, GLProfile[GL4bc/GL4bc.hw], offscr[pbuffer]]
        GLCaps[wgl vid 73 arb: rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, one, mono  , hw, GLProfile[GL4bc/GL4bc.hw], offscr[pbuffer]]
        GLCaps[wgl vid 74 arb: rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 24/8/0, one, mono  , hw, GLProfile[GL4bc/GL4bc.hw], offscr[pbuffer]]
        GLCaps[wgl vid 75 arb: rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 0/0/0, one, mono  , hw, GLProfile[GL4bc/GL4bc.hw], offscr[pbuffer]]
        GLCaps[wgl vid 76 arb: rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, one, mono  , hw, GLProfile[GL4bc/GL4bc.hw], offscr[pbuffer]]
        GLCaps[wgl vid 77 arb: rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 24/8/0, one, mono  , hw, GLProfile[GL4bc/GL4bc.hw], offscr[pbuffer]]
        GLCaps[wgl vid 78 arb: rgba 11/11/10/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 0/0/0, one, mono  , hw, GLProfile[GL4bc/GL4bc.hw], offscr[pbuffer]]
        GLCaps[wgl vid 79 arb: rgba 11/11/10/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, one, mono  , hw, GLProfile[GL4bc/GL4bc.hw], offscr[pbuffer]]
        GLCaps[wgl vid 80 arb: rgba 11/11/10/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 24/8/0, one, mono  , hw, GLProfile[GL4bc/GL4bc.hw], offscr[pbuffer]]

EGL Capabilities:
        none


Requesting: GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]]
Main Monitor: Monitor[Id 0x0 [primary], 309 x 173 mm, pixelScale [1.0, 1.0], viewport [ 0 / 0  1366 x 768 ] [pixels], [ 0 / 0  1366 x 768 ] [window], orig [Id 0x0, [ 1366 x 768 pixels x 32 bpp ] @ 60.0 Hz, flags [], 0 degr], curr [Id 0x0, [ 1366 x 768 pixels x 32 bpp ] @ 60.0 Hz, flags [], 0 degr], modeChanged false, modeCount 208]
    pixel/mm [4.420712, 4.4393063]
    pixel/in [112.28608, 112.75838]
-----------------------------------------------------------------------------------------------------
WindowsGraphicsDevice[type .windows, connection decon]:
        Natives
                GL4bc true [4.3 (Compat profile, arb, compat[ES2, ES3], FBO, hardware)]
                GL4 true [4.3 (Core profile, arb, compat[ES2, ES3], FBO, hardware)]
                GLES3 false
                GL3bc true [4.3 (Compat profile, arb, compat[ES2, ES3], FBO, hardware)]
                GL3 true [4.3 (Core profile, arb, compat[ES2, ES3], FBO, hardware)]
                GL2 true [4.3 (Compat profile, arb, compat[ES2, ES3], FBO, hardware)]
                GLES2 false
                GLES1 false
                Count 5 / 8
        Common
                GL4ES3 true
                GL2GL3 true
                GL2ES2 true
                GL2ES1 true
        Mappings
                GL2ES2 GLProfile[GL2ES2/GL4.hw]
                GL2ES1 GLProfile[GL2ES1/GL4bc.hw]
                GL2 GLProfile[GL2/GL4bc.hw]
                GL4 GLProfile[GL4/GL4.hw]
                GL4bc GLProfile[GL4bc/GL4bc.hw]
                GL3 GLProfile[GL3/GL4.hw]
                GL4ES3 GLProfile[GL4ES3/GL4.hw]
                GL2GL3 GLProfile[GL2GL3/GL4bc.hw]
                GL3bc GLProfile[GL3bc/GL4bc.hw]
                default GLProfile[GL4bc/GL4bc.hw]
                Count 9 / 12

Swap Interval  1
GL Profile     GLProfile[GL4bc/GL4bc.hw]
GL Version     4.3 (Compat profile, arb, compat[ES2, ES3], FBO, hardware) - 4.3.0 - Build 10.18.14.4414 [GL 4.3.0, vendor 10.18.14 (- Build 10.18.14.4414)]
Quirks         [NoDoubleBufferedBitmap, NoSurfacelessCtx]
Impl. class    jogamp.opengl.gl4.GL4bcImpl
GL_VENDOR      Intel
GL_RENDERER    Intel(R) HD Graphics 4400
GL_VERSION     4.3.0 - Build 10.18.14.4414
GLSL           true, has-compiler-func: true, version: 4.30 - Build 10.18.14.4414 / 4.30.0
GL FBO: basic true, full true
GL_EXTENSIONS  208
GLX_EXTENSIONS 0
-----------------------------------------------------------------------------------------------------
Requested: GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]]
Chosen   : GLCaps[wgl vid 7 arb: rgba 8/8/8/8, opaque, accum-rgba 16/16/16/16, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]]
GL impl. class jogamp.opengl.gl4.GL4bcImpl
GL4ES3 retrieved, impl. class jogamp.opengl.gl4.GL4bcImpl
GL3 retrieved, impl. class jogamp.opengl.gl4.GL4bcImpl

Reply | Threaded
Open this post in threaded view
|

Re: How to Draw a Smooth Curve through a Set of 2D Points

Xerxes Rånby
If you pass the following two options
 -Djogl.debug.DebugGL -Djogl.debug.GLSLCode
to java then jogl will be more verbose what went wrong on your hardware while compiling the shaders and check if your driver returns an error

GL Profile     GLProfile[GL4bc/GL4bc.hw]
GL Version     4.3 (Compat profile, arb, compat[ES2, ES3], FBO, hardware) - 4.3.0 - Build 10.18.14.4414 [GL 4.3.0, vendor 10.18.14 (- Build 10.18.14.4414)]
Quirks         [NoDoubleBufferedBitmap, NoSurfacelessCtx]
Impl. class    jogamp.opengl.gl4.GL4bcImpl
GL_VENDOR      Intel
GL_RENDERER    Intel(R) HD Graphics 4400
GL_VERSION     4.3.0 - Build 10.18.14.4414
GLSL           true, has-compiler-func: true, version: 4.30 - Build 10.18.14.4414 / 4.30.0
GL FBO: basic true, full true
GL_EXTENSIONS  208
GLX_EXTENSIONS 0
-----------------------------------------------------------------------------------------------------
Requested: GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]]
Chosen   : GLCaps[wgl vid 7 arb: rgba 8/8/8/8, opaque, accum-rgba 16/16/16/16, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]]
GL impl. class jogamp.opengl.gl4.GL4bcImpl
GL4ES3 retrieved, impl. class jogamp.opengl.gl4.GL4bcImpl
GL3 retrieved, impl. class jogamp.opengl.gl4.GL4bcImpl

Reply | Threaded
Open this post in threaded view
|

Re: How to Draw a Smooth Curve through a Set of 2D Points

mahesh
I changed main function to  this
public static void main(String[] args) {
        GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2ES2));
        caps.setAlphaBits(4);
	GLWindow glWindow = GLWindow.create(caps);
        glWindow.setSize(800,400);
        glWindow.setTitle("JogAmp JOGL Graph API nurbs demo");
        glWindow.setVisible(true);
        System.setProperty( "Djogl.debug.GLSLCode", "true");
        System.setProperty( "Djogl.debug.DebugGL", "true");
     
         GLWindow.main(args);
        glWindow.addGLEventListener(new GraphNurbs() /* GLEventListener */);

        Animator animator = new Animator();
        animator.add(glWindow);
        animator.start();

    }


The output is

Swap Interval  1
GL Profile     GLProfile[GL4bc/GL4bc.hw]
GL Version     4.3 (Compat profile, arb, compat[ES2, ES3], FBO, hardware) - 4.3.0 - Build 10.18.14.4414 [GL 4.3.0, vendor 10.18.14 (- Build 10.18.14.4414)]
Quirks         [NoDoubleBufferedBitmap, NoSurfacelessCtx]
Impl. class    jogamp.opengl.gl4.GL4bcImpl
GL_VENDOR      Intel
GL_RENDERER    Intel(R) HD Graphics 4400
GL_VERSION     4.3.0 - Build 10.18.14.4414
GLSL           true, has-compiler-func: true, version: 4.30 - Build 10.18.14.4414 / 4.30.0
GL FBO: basic true, full true
GL_EXTENSIONS  208
GLX_EXTENSIONS 0
-----------------------------------------------------------------------------------------------------
Requested: GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]]
Chosen   : GLCaps[wgl vid 7 arb: rgba 8/8/8/8, opaque, accum-rgba 16/16/16/16, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]]
GL impl. class jogamp.opengl.gl4.GL4bcImpl
GL4ES3 retrieved, impl. class jogamp.opengl.gl4.GL4bcImpl
GL3 retrieved, impl. class jogamp.opengl.gl4.GL4bcImpl
XXX: Cubic: 4: [ID: 2147483647, onCurve: false: p 7.0, 15.0, 0.0, t 0.0, 0.0, 0.0], 5: [ID: 2147483647, onCurve: false: p 6.0, 8.0, 0.0, t 0.0, 0.0, 0.0]

Reply | Threaded
Open this post in threaded view
|

Re: How to Draw a Smooth Curve through a Set of 2D Points

Xerxes Rånby
This post was updated on .
I have updated my example to include correct System.setProperty lines to enable debugging
        System.setProperty( "jogl.debug.GLSLCode", "");
        System.setProperty( "jogl.debug.DebugGL", "");

And I have updated the example to be more correct by
enable the RegionRenderer on the OpenGL context before draw and disable it on the OpenGL context after draw. Before I only enabled it once during init.
            // Draw the static shape using RegionRenderer and GLRegion
            regionRenderer.enable(gl, true);
            glRegion.draw(gl, regionRenderer, sampleCount);
            regionRenderer.enable(gl, false);

I also updated the example to actually stop the Animator thread on window close.

Please try the updated example and see if it work better on your Intel OpenGL driver:
http://forum.jogamp.org/How-to-Draw-a-Smooth-Curve-through-a-Set-of-2D-Points-tp4037677p4037685.html
Reply | Threaded
Open this post in threaded view
|

Re: How to Draw a Smooth Curve through a Set of 2D Points

elect
Xerses, why don't creating a github repo for that?
Reply | Threaded
Open this post in threaded view
|

Re: How to Draw a Smooth Curve through a Set of 2D Points

Xerxes Rånby
elect wrote
Xerses, why don't creating a github repo for that?
Good idea.
I have put the How to Draw a Smooth Curve through a Set of 2D Points using graph example into the following git:

https://github.com/xranby/jogamp-forum-examples
https://github.com/xranby/jogamp-forum-examples/commit/7e365af6801c7f1d15ad4d1948514c6acc1a2870

When the example is good enough then we may put it in jogl-demos

Cheers
Xerxes
Reply | Threaded
Open this post in threaded view
|

Re: How to Draw a Smooth Curve through a Set of 2D Points

elect
Nice

I may implement gradle on that if you'd like too, it'd make things easiest as possible
12