Posted by
yaqiang on
Feb 07, 2022; 3:56pm
URL: https://forum.jogamp.org/TextRender-only-work-after-reshape-with-GL-TEXTURE2-binding-tp4041609p4041631.html
The following code in VolumeTest.java can plot the texts, but I don't know why and of course it's not a good solution.
public static void main(String[] args) throws IOException {
VolumeTest test = new VolumeTest();
test.readData();
test.readColorMap();
VolumeGraphics graphics = test.createGraphics();
graphics.setRayCastingType(RayCastingType.SPECULAR);
JFrame frame = new JFrame("Volume Test");
Plot3DGL plot = new Plot3DGL();
plot.setOrthographic(false);
plot.setClipPlane(false);
//plot.setBackground(Color.black);
//plot.setForeground(Color.blue);
plot.setDrawBoundingBox(false);
plot.setDrawBase(false);
plot.setBoxed(false);
plot.getGridLine().setDrawXLine(false);
plot.getGridLine().setDrawYLine(false);
plot.getGridLine().setDrawZLine(false);
GLChartPanel canvas = new GLChartPanel(plot);
plot.addGraphic(graphics);
frame.getContentPane().add(canvas);
frame.pack();
frame.setSize(600, 400);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
int width = canvas.getWidth();
int height = canvas.getHeight();
canvas.setSize(width, height + 1);
canvas.setSize(width, height);
//frame.setSize(600, 401);
}
www.meteothink.org