jogamp
›
jogl
Login
Register
Runtime switch bewteen orthographic and perspective projections
Posted by
yaqiang
on
Aug 10, 2022; 3:33am
URL:
https://forum.jogamp.org/Runtime-switch-bewteen-orthographic-and-perspective-projections-tp4041812.html
3D rendering class of Plot3DGL which implemented GLEventListener interface in MeteoInfo support both orthographic and perspective projections in "reshape" method (
https://github.com/meteoinfo/MeteoInfo/blob/master/meteoinfo-chart/src/main/java/org/meteoinfo/chart/jogl/Plot3DGL.java#L4290-L4330
). "orthgraphic" is a boolean variable to control it throught the public method "setOrthographic" (
https://github.com/meteoinfo/MeteoInfo/blob/master/meteoinfo-chart/src/main/java/org/meteoinfo/chart/jogl/Plot3DGL.java#L971-L980
). The problem is that I have to resize the plot panel which trigger the "reshape" method to plot the 3D graphics in correct projections after "setOrthographic" method was called.
So I tried to add "updateProjections" method to change the projection (
https://github.com/meteoinfo/MeteoInfo/blob/master/meteoinfo-chart/src/main/java/org/meteoinfo/chart/jogl/Plot3DGL.java#L4332-L4367
). This method was tried to called in "setOrthographic" method to update and plot graphics in new projections. But I got error of "javax.media.opengl.GLException: No OpenGL context current on this thread" with the code "glu.gluPerspective(45.0f, 1.0f, near, far);" in the "updateProjections" method.
GLUgl2 was also tested but with same error result.
Any help is appreciated!
www.meteothink.org
Free forum by Nabble
Edit this page