Repository navigation
fix: enable depth test at FsSetCameraPosition (gl2.0) - #8
Open
tomingtoming wants to merge 1 commit into
Open
tomingtoming wants to merge 1 commit into
tomingtoming wants to merge 1 commit into
Conversation
FsSetCameraPosition is the gl2.0 driver's scene-start state-reset point: it already sets glDepthFunc/glDepthMask, clears Z, and enables face culling -- but relied on GL_DEPTH_TEST being enabled by whoever drew before. Overlay passes (HUD glass, sky gradation) disable the depth test without restoring it, so after a simulation frame has run, the network-standby aircraft chooser drew its 3D preview with the depth test still off: triangles resolved in draw order and the model rendered inside-out / hollow (tomingtoming/ysflight-web#84 -- reproduced on both server and client, never from the cold main menu, which is exactly the stale-state signature). glEnable is idempotent and every FsSetCameraPosition caller is a real 3D scene start, so the enable is safe for the in-simulation paths that already run with the test on. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UvHHZQtkJT6EyefM9o77Kx
tomingtoming
force-pushed
the
upstream-fix/gl2-depth-test
branch
from
August 13, 2026 09:17
db0ea13 to
cbdbd5f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In server mode, the network-standby aircraft chooser draws its 3D preview with the depth test disabled: triangles resolve in painter's order and the model renders inside-out / hollow. It never happens from the cold main menu — only after a simulation frame has run, which is the stale-state signature.
Cause: overlay passes (HUD glass, sky gradation, ...) call
glDisable(GL_DEPTH_TEST)and do not restore it.FsSetCameraPositionis the gl2.0 driver's scene-start state-reset point — it already setsglDepthFunc/glDepthMask, clears Z and enables face culling — but it relies onGL_DEPTH_TESThaving been left enabled by whoever drew before.Fix: one
glEnable(GL_DEPTH_TEST)at that reset point.glEnableis idempotent and everyFsSetCameraPositioncaller is a real 3D scene start, so the in-simulation paths that already run with the test enabled are unaffected.Reproduction (stock desktop build, Linux, gl2.0)
./ysflight64_gl2 -server SMALL_MAPReady to go!, pressA(Choose Airplane)With this one-line fix, the same steps render the model solid:
(full screenshots: before, after)
First found on the WebAssembly port (tomingtoming/ysflight-web#84), where per-draw GL instrumentation isolated the only state difference between the healthy path and the broken path to
GL_DEPTH_TEST(healthy: enabled on every draw; after hosting: disabled on the chooser preview draws). The reproduction above confirms the same defect in the stock desktop gl2.0 build.