SW Tracking Report Feature Objectives Overview and Rudimentary standalone example using the fixed pipeline by Julien Gouesse: Difference between pages

From JogampWiki
(Difference between pages)
Jump to navigation Jump to search
 
(Adds instructions to compile and run the example)
 
Line 1: Line 1:
This list exposes building blocks
This program displays a simple 3D rendering of a polygon using JOGL. Please note though that this code is a demonstration of the use of JOGL and as such makes use of immediate mode drawing commands; this serves to show how the conventional C style API is used through JOGL, but it is strongly recommended to make use of modern OpenGL techniques.
for potential use and business case scenarios
using Java & JogAmp on Desktop and Embedded Devices.


Notably [[#Graph|Graph & Graph UI]] as well as [[#NEWT_+_Wayland|Wayland]] & [[#Vulkan|Vulkan]] support could be of interest here?
<pre>import java.awt.*;
import java.awt.event.*;
import com.jogamp.opengl.*;
import com.jogamp.opengl.awt.GLCanvas;
import com.jogamp.opengl.fixedfunc.*;
import com.jogamp.opengl.util.Animator;
/**
* Self-contained example (within a single class only to keep it simple)
* displaying a rotating quad
*/
public class JOGLQuad implements GLEventListener {
private float rotateT = 0.0f;
@Override
public void display(GLAutoDrawable gLDrawable) {
final GL2 gl = gLDrawable.getGL().getGL2();
gl.glClear(GL.GL_COLOR_BUFFER_BIT);
gl.glClear(GL.GL_DEPTH_BUFFER_BIT);
gl.glLoadIdentity();
gl.glTranslatef(0.0f, 0.0f, -5.0f);
// rotate about the three axes
gl.glRotatef(rotateT, 1.0f, 0.0f, 0.0f);
gl.glRotatef(rotateT, 0.0f, 1.0f, 0.0f);
gl.glRotatef(rotateT, 0.0f, 0.0f, 1.0f);
// Draw A Quad
gl.glBegin(GL2.GL_QUADS);     
gl.glColor3f(0.0f, 1.0f, 1.0f);  // set the color of the quad
gl.glVertex3f(-1.0f, 1.0f, 0.0f);  // Top Left
gl.glVertex3f( 1.0f, 1.0f, 0.0f);  // Top Right
gl.glVertex3f( 1.0f,-1.0f, 0.0f);  // Bottom Right
gl.glVertex3f(-1.0f,-1.0f, 0.0f);  // Bottom Left
// Done Drawing The Quad
gl.glEnd();                                                   
// increasing rotation for the next iteration                 
rotateT += 0.2f;
}
@Override
public void init(GLAutoDrawable glDrawable) {
GL2 gl = glDrawable.getGL().getGL2();
gl.glShadeModel(GLLightingFunc.GL_SMOOTH);
gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
gl.glClearDepth(1.0f);
gl.glEnable(GL.GL_DEPTH_TEST);
gl.glDepthFunc(GL.GL_LEQUAL);
gl.glHint(GL2ES1.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST);
}
@Override
public void reshape(GLAutoDrawable gLDrawable, int x, int y, int width, int height) {
GL2 gl = gLDrawable.getGL().getGL2();
final float aspect = (float) width / (float) height;
gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
gl.glLoadIdentity();
final float fh = 0.5f;
final float fw = fh * aspect;
gl.glFrustumf(-fw, fw, -fh, fh, 1.0f, 1000.0f);
gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
gl.glLoadIdentity();
}
@Override
public void dispose(GLAutoDrawable gLDrawable) {
}
public static void main(String[] args) {
final GLCanvas canvas = new GLCanvas();
final Frame frame = new Frame("Jogl Quad drawing");
final Animator animator = new Animator(canvas);
canvas.addGLEventListener(new JOGLQuad());
frame.add(canvas);
frame.setSize(640, 480);
frame.setResizable(false);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
animator.stop();
frame.dispose();
System.exit(0);
}
});
frame.setVisible(true);
animator.start();
canvas.requestFocus();
}
}
</pre>


Also see [[Completed Features Objectives]] ...
You can compile the source code above with Java >= 9 by entering (the JogAmp fat JAR jogamp-fat.jar is required):
<pre>javac -cp jogamp-fat.jar JOGLQuad.java</pre>


= Graph =
You can run this example by entering (under other operating systems except Windows):
[https://jausoft.com/blog/tag/graph_type_rendering/ Graph/GraphUI Progress Blog Entries]
<pre>java --add-exports java.base/java.lang=ALL-UNNAMED --add-exports java.desktop/sun.java2d=ALL-UNNAMED --add-opens java.desktop/sun.awt=ALL-UNNAMED -cp jogamp-fat.jar:. JOGLQuad</pre>


== Desired Work Items ==
You can run this example by entering (under Windows):
 
<pre>java --add-exports java.base/java.lang=ALL-UNNAMED --add-exports java.desktop/sun.java2d=ALL-UNNAMED --add-opens java.desktop/sun.awt=ALL-UNNAMED -cp jogamp-fat.jar;. JOGLQuad</pre>
This is an ad-hoc list of desired features and fixes,
which shall result in proper bug-reports soon.
 
After having reached [https://jausoft.com/blog/2024/01/21/graphui-frustum-culling-clipping-modelview-space/ UI usability with widgets and clipping],
the following items are becoming more interesting
 
* Fix general issues with current implementation and API, if any
* Fix Graph rendering bugs (Tessellation)
** [https://jausoft.com/blog/2024/02/13/fixing-jogamps-graph-delaunay-tessellation-of-complex-non-convex-shapes/ First round done]
* Use of super-sized triangles to render Graph lines & curves to allow
** Using a one-pass smooth AA Graph renderer to save resources otherwise used in our pass-2 FBO supersampling renderer
** Generate outlines, i.e. outlined fonts
** Generate special effects like glowing/pumping outlines indicating selection etc
* Allow passing or better attaching per-vertex color to Graph Outline (API)
* <s>Add subtitles in MediaPlayer GraphUI widget</s> ''([https://jausoft.com/blog/2024/02/07/graphui-mediaplayer-feature-complete/ done])''
* Add video encoding in our FFmpeg binding, i.e. an FFMPEGMediaRecorder (Encoding + Multiplexing)
 
Further more, if so desired, a C++ implementation of our Graph + GraphUI framework
may also be of interest.
 
In case any company or organization is interested and likes to support
this work and may also like to receive support in adopting this framework,
please contact [[Maintainer_and_Contacts#Commercial_Support|Göthel Software e.K.]]
 
== Graph UI ==
 
[https://jausoft.com/blog/2023/02/22/reimagine-java-on-desktop-bare-metal-devices/ ''Graph UI'' will enable an immersive UI within the 3D scene] on the desktop, mobile and on bare-metal embedded systems without a windowing system.
 
Graph UI utilizes [https://jausoft.com/blog/2011/10/05/jogljogamp-red-square-moscow-nurbs-graphicon2011/ Resolution Independent NURBS Curves Rendering using Programmable Graphics Pipeline], i.e. rendering curves directly on the GPU, resolution independent [ [https://jogamp.org/doc/gpunurbs2011/p70-santina.pdf paper], [https://jogamp.org/doc/gpunurbs2011/graphicon2011-slides.pdf slides] ].
 
This method allows us to to have an ultimate fast font and UI rendering engine, suitable for all devices and applications. No CPU based curve nor font pre-rendering (matching a target resolution) is required.
 
Think of an integrated QT or OpenJFX in your 2D/3D application
working on desktop and embedded devices even w/o any windowing system on top
of a plain console [{{SERVER}}/bugzilla/show_bug.cgi?id=1156  DRM/GBM as support by JOGL(EGL) and NEWT]
as demonstrated [https://ict.zafena.se/improved-graphical-information-technology/ by Xerxes on a Raspberry Pi4].
 
[https://jausoft.com/blog/2023/02/22/reimagine-java-on-desktop-bare-metal-devices/ Reimagine Java on Desktop & Bare-Metal Devices]
demonstrates the updated Graph Curve Rendering and UI, while [https://jausoft.com/blog/2024/01/21/graphui-frustum-culling-clipping-modelview-space/ this update shows clipping and widgets]. [https://jausoft.com/blog/tag/graph_type_rendering/ Further updates will be posted here...].
 
Notably the ''Graph Curve Rendering'' is almost feature complete, as well as our own user input including gesture detection within NEWT.
 
;Parent Main Node
: [{{SERVER}}/bugzilla/showdependencytree.cgi?id=803&hide_resolved=0 Dependency Tree]
: [{{SERVER}}/bugzilla/buglist.cgi?bug_status=UNCONFIRMED&bug_status=CONFIRMED&bug_status=IN_PROGRESS&bug_status=RESOLVED&bug_status=VERIFIED&columnlist=product%2Ccomponent%2Cassigned_to%2Cbug_status%2Cresolution%2Cversion%2Cshort_desc%2Cchangeddate&component=core&component=Plugin&list_id=2265&product=GraphUI&query_format=advanced&resolution=---&resolution=FIXED&resolution=INVALID&resolution=WONTFIX&resolution=DUPLICATE&resolution=WORKSFORME&resolution=MOVED All GraphUI]
 
;Open Items ''graphui''
<bugzilla>
    {
        "status":["IN_PROGRESS","CONFIRMED", "UNCONFIRMED"],
        "product":"graphui",
        "include_fields":"id,version,product,component,priority,severity,status,summary"
    }
</bugzilla>
 
;Completed Items ''graphui''
<bugzilla>
    {
        "status":["RESOLVED","VERIFIED"],
        "product":"graphui",
        "include_fields":"id,version,product,component,status,resolution,summary"
    }
</bugzilla>
 
== Jogl / Graph ==
 
[{{SERVER}}/bugzilla/showdependencytree.cgi?id=1064&hide_resolved=0 Dependency Tree Graph Font Issues]
 
[{{SERVER}}/bugzilla/buglist.cgi?bug_status=UNCONFIRMED&bug_status=CONFIRMED&bug_status=IN_PROGRESS&bug_status=RESOLVED&bug_status=VERIFIED&columnlist=product%2Ccomponent%2Cassigned_to%2Cbug_status%2Cresolution%2Cversion%2Cshort_desc%2Cchangeddate&component=graph&list_id=2264&product=Jogl&query_format=advanced&resolution=---&resolution=FIXED&resolution=INVALID&resolution=WONTFIX&resolution=DUPLICATE&resolution=WORKSFORME&resolution=MOVED All Jogl Graph]
 
;Open Items ''Jogl / graph''
<bugzilla>
    {
        "status":["IN_PROGRESS","CONFIRMED", "UNCONFIRMED"],
        "product":"jogl",
        "component":"graph",
        "include_fields":"id,version,product,component,priority,severity,status,summary"
    }
</bugzilla>
 
;Completed Items ''Jogl / graph''
<bugzilla>
    {
        "status":["RESOLVED","VERIFIED"],
        "product":"jogl",
        "component":"graph",
        "include_fields":"id,version,product,component,status,resolution,summary"
    }
</bugzilla>
 
= OpenJFX =
 
[https://jogamp.org/bugzilla//show_bug.cgi?id=607#c20 Bug report 607] describes different ways to either
* enhance external rendering via JOGL into an OpenJFX UI elements, or
* to replace OpenJFX's Glass w/ NEWT and Prism's OpenGL coding with JOGL
 
= NEWT =
 
* [{{SERVER}}/bugzilla/showdependencytree.cgi?id=807&hide_resolved=0 Dependency Tree NEWT Input Devices]
* [{{SERVER}}/bugzilla/showdependencytree.cgi?id=814&hide_resolved=0 Dependency Tree NEWT Pointer Event]
 
<bugzilla>
    {
        "product":["newt","jinput"],
        "version":["2.5.0","3.0.0","tbd"],
        "cf_type":"FEATURE",
        "include_fields":"id,version,product,component,priority,severity,status,summary"
    }
</bugzilla>
 
= NEWT + Wayland =
Currently NEWT supports the X11/Xorg windowing server on Unix alike platforms.
 
It might be desired to add direct support to Wayland, as we already added support for
[https://jogamp.org/bugzilla/show_bug.cgi?id=1156 bare metal devices w/o a windowing system via the Linux DRM/GBM console mode]
throughout JOGL + NEWT.
 
= Vulkan  =
 
<bugzilla>
    {
        "component":"vulkan",
        "cf_type":"FEATURE",
        "include_fields":"id,version,product,component,priority,severity,status,summary"
    }
</bugzilla>
 
= Video Encoding/Decoding & Player =
 
Across our releases, we supported video encoding and decoding (with a player)
based on either FFmpeg or Android's library as [https://youtu.be/4gWStKCioi8?t=132 shown in this clip at 2:12 min mark].
 
Goal would be to
* Update general ffmpeg video decoding support
* Enhance ffmpeg video encoding support
* Potentially add better control about video-frame to framebuffer control for editing software
 
See [https://jogamp.org/bugzilla//buglist.cgi?bug_status=__open__&component=video&list_id=3053&product=Jogl related buglist]
 
<bugzilla>
    {
        "component":"video",
        "include_fields":"id,version,product,component,priority,severity,status,summary"
    }
</bugzilla>
 
= iOS Enhancements =
 
Early iOS support has been demonstrated in 2019
* [https://jausoft.com/blog/2019/06/17/jogamp-ios-arm64-bring-up/ iOS Arm64 bring-up]
* [https://jausoft.com/blog/2019/06/23/jogamp-ios-arm64-port-first-visuals/ iOS Arm64 Port: First Visuals]
* [https://jausoft.com/blog/2019/07/08/jogamp-ios-arm64-port-newt/ iOS Arm64 Port: NEWT]
 
Enhancing this port would allow to use JogAmp in a similar fashion as on Android,
but using an OpenJDK iOS build.
 
= [[SCC Overview|Source Certification Contract (SCC)]] =
 
[{{SERVER}}/bugzilla/showdependencytree.cgi?id=1368&hide_resolved=0 Dependency Tree]
 
[{{SERVER}}/bugzilla/show_bug.cgi?id=1368 Root Parent Entry]
 
<bugzilla>
    {
        "id":["1368", "1369"],
        "include_fields":"id,version,product,component,priority,severity,status,summary"
    }
</bugzilla>
 
= Misc =
 
<!-- bugzilla>
    {
        "product"!=["graphui","newt"],
        "component"!=["graph","vulkan"],
        "version":["2.5.0","3.0.0","tbd"],
        "cf_type":"FEATURE",
        "include_fields":"id,version,product,component,priority,severity,status,summary"
    }
</bugzilla-->
 
<bugzilla>
    {
        "version":["2.5.0","3.0.0","tbd"],
        "cf_type":"FEATURE",
        "include_fields":"id,version,product,component,priority,severity,status,summary"
    }
</bugzilla>

Revision as of 14:18, 4 March 2024

This program displays a simple 3D rendering of a polygon using JOGL. Please note though that this code is a demonstration of the use of JOGL and as such makes use of immediate mode drawing commands; this serves to show how the conventional C style API is used through JOGL, but it is strongly recommended to make use of modern OpenGL techniques.

import java.awt.*;
import java.awt.event.*;
import com.jogamp.opengl.*;
import com.jogamp.opengl.awt.GLCanvas;
import com.jogamp.opengl.fixedfunc.*;
import com.jogamp.opengl.util.Animator;
 
/**
 * Self-contained example (within a single class only to keep it simple) 
 * displaying a rotating quad
 */
public class JOGLQuad implements GLEventListener {
 
	private float rotateT = 0.0f;
 
	@Override
	public void display(GLAutoDrawable gLDrawable) {
		final GL2 gl = gLDrawable.getGL().getGL2();
		gl.glClear(GL.GL_COLOR_BUFFER_BIT);
		gl.glClear(GL.GL_DEPTH_BUFFER_BIT);
		gl.glLoadIdentity();
		gl.glTranslatef(0.0f, 0.0f, -5.0f);
 
		// rotate about the three axes
		gl.glRotatef(rotateT, 1.0f, 0.0f, 0.0f);
		gl.glRotatef(rotateT, 0.0f, 1.0f, 0.0f);
		gl.glRotatef(rotateT, 0.0f, 0.0f, 1.0f);
 
		// Draw A Quad
		gl.glBegin(GL2.GL_QUADS);       
		gl.glColor3f(0.0f, 1.0f, 1.0f);   // set the color of the quad
		gl.glVertex3f(-1.0f, 1.0f, 0.0f);   // Top Left
		gl.glVertex3f( 1.0f, 1.0f, 0.0f);   // Top Right
		gl.glVertex3f( 1.0f,-1.0f, 0.0f);   // Bottom Right
		gl.glVertex3f(-1.0f,-1.0f, 0.0f);   // Bottom Left
		// Done Drawing The Quad
		gl.glEnd();                                                     
 
		// increasing rotation for the next iteration                   
		rotateT += 0.2f; 
	}
 
	@Override
	public void init(GLAutoDrawable glDrawable) {
		GL2 gl = glDrawable.getGL().getGL2();
		gl.glShadeModel(GLLightingFunc.GL_SMOOTH);
		gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
		gl.glClearDepth(1.0f);
		gl.glEnable(GL.GL_DEPTH_TEST);
		gl.glDepthFunc(GL.GL_LEQUAL);
		gl.glHint(GL2ES1.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST);
	}
 
	@Override
	public void reshape(GLAutoDrawable gLDrawable, int x, int y, int width, int height) {
		GL2 gl = gLDrawable.getGL().getGL2();
		final float aspect = (float) width / (float) height;
		gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
		gl.glLoadIdentity();
		final float fh = 0.5f;
		final float fw = fh * aspect;
		gl.glFrustumf(-fw, fw, -fh, fh, 1.0f, 1000.0f);
		gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
		gl.glLoadIdentity();
	}
 
	@Override
	public void dispose(GLAutoDrawable gLDrawable) {
	}
 
	public static void main(String[] args) {
		final GLCanvas canvas = new GLCanvas();
		final Frame frame = new Frame("Jogl Quad drawing");
		final Animator animator = new Animator(canvas);
		canvas.addGLEventListener(new JOGLQuad());
		frame.add(canvas);
		frame.setSize(640, 480);
		frame.setResizable(false);
		frame.addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent e) {
				animator.stop();
				frame.dispose();
				System.exit(0);
			}
		});
		frame.setVisible(true);
		animator.start();
		canvas.requestFocus();
	}
}

You can compile the source code above with Java >= 9 by entering (the JogAmp fat JAR jogamp-fat.jar is required):

javac -cp jogamp-fat.jar JOGLQuad.java

You can run this example by entering (under other operating systems except Windows):

java --add-exports java.base/java.lang=ALL-UNNAMED --add-exports java.desktop/sun.java2d=ALL-UNNAMED --add-opens java.desktop/sun.awt=ALL-UNNAMED -cp jogamp-fat.jar:. JOGLQuad

You can run this example by entering (under Windows):

java --add-exports java.base/java.lang=ALL-UNNAMED --add-exports java.desktop/sun.java2d=ALL-UNNAMED --add-opens java.desktop/sun.awt=ALL-UNNAMED -cp jogamp-fat.jar;. JOGLQuad