Fix depth peeling demo to let them work with the former

TextBitmapRenderer
This commit is contained in:
martin 2022-02-15 18:17:21 +01:00
parent 747737c9b3
commit 900dd9f148
5 changed files with 24 additions and 4 deletions

View File

@ -12,6 +12,7 @@ import org.jzy3d.plot3d.primitives.ParallelepipedComposite.PolygonType;
import org.jzy3d.plot3d.primitives.PolygonMode;
import org.jzy3d.plot3d.rendering.canvas.CanvasAWT;
import org.jzy3d.plot3d.rendering.ddp.algorithms.PeelingMethod;
import org.jzy3d.plot3d.text.renderers.TextBitmapRenderer;
import com.jogamp.opengl.GLContext;
import com.jogamp.opengl.awt.GLCanvas;
@ -45,6 +46,9 @@ public class PeeledCubesDemo {
AWTChartFactory f = new AWTChartFactory(p);
Chart chart = f.newChart();
// depth peeling shaders do not mix correctly with 2.0.1 TextRenderer
chart.getView().getAxis().setTextRenderer(new TextBitmapRenderer());
Coord3d p1 = Coord3d.ORIGIN;
Coord3d p2 = new Coord3d(0.005f, 0.005f, 0.005f);

View File

@ -11,6 +11,7 @@ import org.jzy3d.maths.Coord3d;
import org.jzy3d.maths.Rectangle;
import org.jzy3d.plot3d.primitives.vbo.drawable.DrawableVBO;
import org.jzy3d.plot3d.rendering.lights.Light;
import org.jzy3d.plot3d.text.renderers.TextBitmapRenderer;
/**
* Download https://download.jzy3d.org/objfiles/dragon.obj to src/library/models/dragon.obj if not yet available.
@ -26,6 +27,10 @@ public class PeeledDragonDemo {
AWTChartFactory f = new AWTChartFactory(new DepthPeelingPainterFactory());
Chart chart = f.newChart();
// depth peeling shaders do not mix correctly with 2.0.1 TextRenderer
chart.getView().getAxis().setTextRenderer(new TextBitmapRenderer());
String objFilePath = "data/models/dragon.obj";
File file = new File("./" + objFilePath);

View File

@ -11,6 +11,7 @@ import org.jzy3d.plot3d.primitives.LineStrip;
import org.jzy3d.plot3d.primitives.ParallelepipedComposite;
import org.jzy3d.plot3d.primitives.Point;
import org.jzy3d.plot3d.rendering.canvas.Quality;
import org.jzy3d.plot3d.text.renderers.TextBitmapRenderer;
public class PeeledStackDemo {
static Color STACK_FACE = new Color(.5f, .5f, .5f, .5f);
@ -25,6 +26,9 @@ public class PeeledStackDemo {
Chart chart = f.newChart(Quality.Nicest());
// depth peeling shaders do not mix correctly with 2.0.1 TextRenderer
chart.getView().getAxis().setTextRenderer(new TextBitmapRenderer());
Coord3d c1 = new Coord3d(0, 0, -2.5);
Coord3d c2 = new Coord3d(10, 10, 19);

View File

@ -16,6 +16,7 @@ import org.jzy3d.plot3d.builder.concrete.OrthonormalGrid;
import org.jzy3d.plot3d.primitives.Shape;
import org.jzy3d.plot3d.rendering.canvas.Quality;
import org.jzy3d.plot3d.rendering.legends.colorbars.AWTColorbarLegend;
import org.jzy3d.plot3d.text.renderers.TextBitmapRenderer;
public class PeeledWireSurfaceDemo {
@ -49,6 +50,10 @@ public class PeeledWireSurfaceDemo {
chart.getScene().getGraph().add(surface);
chart.getScene().getGraph().setStrategy(null);
// depth peeling shaders do not mix correctly with 2.0.1 TextRenderer
chart.getView().getAxis().setTextRenderer(new TextBitmapRenderer());
// Setup a colorbar
AWTColorbarLegend cbar = new AWTColorbarLegend(surface, chart.getView().getAxis().getLayout());

View File

@ -5,7 +5,7 @@ import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import jogamp.nativewindow.jawt.windows.Win32SunJDKReflection;
import sun.awt.Win32GraphicsConfig;
//import sun.awt.Win32GraphicsConfig;
/**
* Analyzing
@ -20,12 +20,14 @@ public class Win32GraphicsConfig_Choose {
getPixelFormatByReflection();
getPixelFormat();
//getPixelFormat();
}
// Unsastified link if it is called first. OK if reflective calls is made before
private static void getPixelFormat() {
//
// Will only work on Windows!
/*private static void getPixelFormat() {
System.out.println("=== getPixelFormat ===");
sun.awt.Win32GraphicsDevice d = new sun.awt.Win32GraphicsDevice(0);
@ -39,7 +41,7 @@ public class Win32GraphicsConfig_Choose {
// reproduce what is found in Win32SunJDKReflection.graphicsConfigurationGetPixelFormatID
int pfdId = c.getVisual();
}
}*/
private static void getPixelFormatByReflection() {
System.out.println("=== getPixelFormatByReflection ===");