Rendering semi-transparent, antialiased triangles with jogl
Posted by
ManuelBrotz on
Feb 21, 2017; 1:54pm
URL: https://forum.jogamp.org/Rendering-semi-transparent-antialiased-triangles-with-jogl-tp4037649.html
Hi
I made a little Eclipse project to help me compare different methods of rendering triangles in Java. I implemented a version for Java2D BufferedImage, Java2D VolatileImage and Jogl AutoDrawable offscreen. The goal is to have every version support semitransparent / opaque triangles, translucent / solid (opaque) images and turning antialiasing on / off. Everything works fine with buffered images and volatile images. However, i have trouble getting antialiasing to work with jogl. I have googled a lot in the past weeks and found many infos on the subject, but nothing seems to work. I have tested my code on several different systems with different GPUs and different operating systems.
When i use gl.glEnable(GL2.GL_POLYGON_SMOOTH), nothing happens. And when i use caps.setSampleBuffers(true), the generated image is simply empty.
I have attached the eclipse project. Can somebody please take a look at it? You find the code in the class PerfTestJogl and the main method in the class TestRunner. The class StaticSettings contains some static settings used to control the behavior of the tests. Every test stores an image file in the ./out/ folder, so you can check the results.
In the class PerfTestJogl you may need to comment / uncomment the code for antialiasing.
If you run the tests under linux don't forget to add the vm argument -Dsun.java2d.opengl=true to activate hardware acceleration for volatile images.
Any help is appreciated!
Manuel Brotz
TrianglePerfTest.zip