summaryrefslogtreecommitdiffstats
path: root/src/demos/com/jogamp/opengl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-03-21 14:16:00 +0100
committerSven Gothel <[email protected]>2023-03-21 14:16:00 +0100
commit74e11bd9a49f61e49d3c73c4f9b87b4fb7fbaaf3 (patch)
treed81d07f0a3190b2cb0e19b3a61883f6162eddcdd /src/demos/com/jogamp/opengl
parent1cbe45b9d7f21a751332d6f8dd948992e75dfe99 (diff)
GraphUI: Fix Scene.PMVMatrixSetup impl: Setup modelview before using setPlanBox(..)'s gluUnProject(..)
Diffstat (limited to 'src/demos/com/jogamp/opengl')
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java6
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java6
2 files changed, 8 insertions, 4 deletions
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java
index 007a5403b..cac6fe77e 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java
@@ -191,16 +191,18 @@ public class UISceneDemo01 {
pmv.gluPerspective(Scene.DEFAULT_ANGLE, ratio, Scene.DEFAULT_ZNEAR, Scene.DEFAULT_ZFAR);
pmv.glTranslatef(0f, 0f, Scene.DEFAULT_SCENE_DIST);
+ pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
+ pmv.glLoadIdentity();
+
// Scale (back) to have normalized plane dimensions, 100 for the greater of width and height.
final AABBox planeBox0 = new AABBox();
setPlaneBox(planeBox0, pmv, x, y, width, height);
final float sx = planeBox0.getWidth();
final float sy = planeBox0.getHeight();
final float sxy = sx > sy ? sx : sy;
+ pmv.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
pmv.glScalef(sxy / 100f, sxy / 100f, 1f);
-
pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
- pmv.glLoadIdentity();
}
@Override
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java
index 6cd5a9b76..433521933 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java
@@ -1092,13 +1092,15 @@ public class UISceneDemo20 implements GLEventListener {
pmv.gluPerspective(Scene.DEFAULT_ANGLE, ratio, Scene.DEFAULT_ZNEAR, Scene.DEFAULT_ZFAR);
pmv.glTranslatef(0f, 0f, Scene.DEFAULT_SCENE_DIST);
+ pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
+ pmv.glLoadIdentity();
+
// Translate origin to bottom-left
final AABBox planeBox0 = new AABBox();
setPlaneBox(planeBox0, pmv, x, y, width, height);
+ pmv.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
pmv.glTranslatef(planeBox0.getMinX(), planeBox0.getMinY(), 0f);
-
pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
- pmv.glLoadIdentity();
}
@Override