Skip to content
This repository was archived by the owner on Dec 15, 2025. It is now read-only.

Commit dc5a67a

Browse files
committed
XP11.50d10 has a bug where it won't update the viewport dataref in OpenGL mode on Linux.
1 parent d13bf84 commit dc5a67a

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

src/bp_cam.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,16 @@ get_vp(vec4 vp)
355355
vp[1] = vp_xp[1];
356356
vp[2] = vp_xp[2] - vp_xp[0];
357357
vp[3] = vp_xp[3] - vp_xp[1];
358+
if (vp[2] == 0 || vp[3] == 0) {
359+
int scr_w, scr_h;
360+
/*
361+
* Due to an outstanding X-Plane 11.50 beta bug, the viewport
362+
* dataref might not be properly updated in OpenGL mode.
363+
*/
364+
XPLMGetScreenSize(&scr_w, &scr_h);
365+
vp[2] = scr_w;
366+
vp[3] = scr_h;
367+
}
358368
}
359369

360370
/*
@@ -383,7 +393,12 @@ vp_unproject(double x, double y, double *x_phys, double *y_phys)
383393
* 3D coordinate based on Z-distance of the camera from the
384394
* reference plane.
385395
*/
396+
ASSERT(!isnan(out_pt[0]));
397+
ASSERT(!isnan(out_pt[1]));
398+
ASSERT(out_pt[2] != 0);
386399
glm_vec_scale(out_pt, ABS(cam_height / out_pt[2]), out_pt);
400+
ASSERT(!isnan(out_pt[0]));
401+
ASSERT(!isnan(out_pt[1]));
387402
*x_phys = out_pt[0];
388403
*y_phys = out_pt[1];
389404
}

0 commit comments

Comments
 (0)