Hi,
I''ve developed a framework for chart using JOGL, and for rendering and transformations I'm using GL2. I have two questions about this: 1. Would the chart be more fast if i would draw it using GL4? Now drawing it's like this: ... gl2.glLoadIdentity(); gl2.glScalef(...) gl2.glTranslatef(...) gl2.glBegin(GL.GL_LINE_STRIP); for (TracePoint p : trace.getIterator()) { gl2.glVertex2f((float) p.getX(), (float) p.getY()); } gl2.glEnd(); .... 2. Would GL2 be deprecated or even removed in 20 years from now? |
Administrator
|
Hello
Using GL4 would help you to drive your code more "future proof" but you can already use GL2 and improve your performance by using retained mode (vertex buffer objects) instead of immediate mode (glBegin, glEnd, glVertex, ...). Some drivers of modern graphics cards already don't support the fixed pipeline at all. Instead of reinventing the loop, have you ever considered using Jzy3d? It's based on JOGL, it allows to draw charts and it has a lot of features, it's well maintained.
Julien Gouesse | Personal blog | Website
|
Thank you very much for your reply!
My video card doesn't support vertex buffer, so for now i will use GL2 with glBegin, glEnd, glVertex.... I tested it on few PC's and it's working fine on all of them. But in the future i will change the code for sure to use vertex buffer objects and GL4 About Jzy3d, i think i will give it a try. The challenge is if that framework supports millions of points in a 2D line chart and having a fast redraw |
Administrator
|
How can you be so sure that your graphics card doesn't support vertex buffer objects? Even the ATI Radeon 9250 released in 2001 supporting only OpenGL 1.3 has some early support of VBOs. Which graphics card do you use?
Why wouldn't it support such use cases? What do you do in your own code to support millions of points and still having a fast redraw?
Julien Gouesse | Personal blog | Website
|
I have a Intel HD Graphics 4000 video card, and i don't do any optimizations to get a fast redraw (case when i use GL2).
https://www.techpowerup.com/gpu-specs/hd-graphics-4000.c1266 I get the following exception when i'm trying to run a snippet with GL4 and vertex buffer objects Exception in thread "main-AWTAnimator#00" com.jogamp.opengl.util.AnimatorBase$UncaughtAnimatorException: com.jogamp.opengl.GLException: Caught GLException: Method "glCreateBuffers" not available on thread main-AWTAnimator#00 at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:92) at com.jogamp.opengl.util.AnimatorBase.display(AnimatorBase.java:452) at com.jogamp.opengl.util.Animator$MainLoop.run(Animator.java:204) at java.lang.Thread.run(Thread.java:748) The exception occurs in the method glCreateBuffers from GL4 FloatBuffer vertexBuffer = GLBuffers.newDirectFloatBuffer(vertexData); ShortBuffer elementBuffer = GLBuffers.newDirectShortBuffer(elementData); IntBuffer bufferName = GLBuffers.newDirectIntBuffer(Buffer.MAX); gl.glCreateBuffers(Buffer.MAX, bufferName); But everything it's working on a PC which has an Intel HD Graphics 620 video card About JZY what version do you recommend me to use? I see on the JZY website is not specified anything about 1.0.2 but just about 1.0.0. Also i saw only 2 commits in the last year. |
Administrator
|
Why not using glGenBuffers instead? glCreateBuffers requires OpenGL 4.5.
I would use Jzy3d 1.0.2. It's an active project but it's a mature library, there is no need of changing everything.
Julien Gouesse | Personal blog | Website
|
This post was updated on .
With glGenBuffers it's working to create the buffers but later i got an exception at
ByteBuffer globalMatricesPointer = gl.glMapNamedBufferRange(this.bufferName.get(Buffer.GLOBAL_MATRICES), 0, 16 * 4 * 2, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT | GL_MAP_INVALIDATE_BUFFER_BIT); // Exception in thread "main-AWTAnimator#00" com.jogamp.opengl.util.AnimatorBase$UncaughtAnimatorException: com.jogamp.opengl.GLException: Caught GLException: Method "glMapNamedBufferRange" not available on thread main-AWTAnimator#00 Caused by: com.jogamp.opengl.GLException: Method "glMapNamedBufferRange" not available at jogamp.opengl.gl4.GL4bcImpl.glMapNamedBufferRangeDelegate(GL4bcImpl.java:19961) at jogamp.opengl.gl4.GL4bcImpl.access$1300(GL4bcImpl.java:29) at jogamp.opengl.gl4.GL4bcImpl$13.mapBuffer(GL4bcImpl.java:40904) at jogamp.opengl.GLBufferObjectTracker.mapBufferImpl(GLBufferObjectTracker.java:402) at jogamp.opengl.GLBufferObjectTracker.mapBuffer(GLBufferObjectTracker.java:340) at jogamp.opengl.gl4.GL4bcImpl.mapNamedBufferRange(GL4bcImpl.java:40898) at jogamp.opengl.gl4.GL4bcImpl.glMapNamedBufferRange(GL4bcImpl.java:40894) at util.gui.newplotter.prototypes.HelloTriangleSimple.initBuffers(HelloTriangleSimple.java:198) at util.gui.newplotter.prototypes.HelloTriangleSimple.init(HelloTriangleSimple.java:115) at jogamp.opengl.GLDrawableHelper.init(GLDrawableHelper.java:644) at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:690) at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:674) at jogamp.opengl.GLAutoDrawableBase$2.run(GLAutoDrawableBase.java:443) at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1293) By the way my video board supports OpenGL 4.0.0 GL_RENDERER Intel(R) HD Graphics 4000 GL_VERSION 4.0.0 - Build 10.18.10.4358 |
Administrator
|
glMapNamedBufferRange is only available in OpenGL >= 4.5 too whereas glMapBufferRange should work on your hardware.
Julien Gouesse | Personal blog | Website
|
Free forum by Nabble | Edit this page |