# digital-earth **Repository Path**: wangjianjun1018/digital-earth ## Basic Information - **Project Name**: digital-earth - **Description**: 使用OpenGL实现的三维地球 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-09-19 - **Last Updated**: 2026-09-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 数字地球digital_earth ![截图](./images/1.png) ![截图](./images/2.png) ![截图](./images/3.webp) ## 项目概况 `digital_earth` 是一个基于 C++、OpenGL 和 GLFW 的三维地球程序。程序按 Web Mercator XYZ 规则请求和缓存地图瓦片,并将瓦片贴到 WGS-84 椭球表面。 - 源码目录:`E:\projects\cppprojects\digital_earth\digital_earth` - 依赖目录:`E:\projects\cppprojects\digital_earth\dependencies` - 瓦片缓存目录:`C:\mapdata\{z}\{x}\{y}.png` - 构建系统:CMake + Visual Studio 2017 x64 ## 依赖 - OpenGL 3.3 - GLFW - GLEW - GLM - stb_image - libcurl(在线瓦片下载) 项目不再依赖 GLU、GDI+ 或 WinInet。图像加载统一使用 `dependencies\stb\stb_image.h`,网络请求使用 `dependencies\curl` 中的静态 libcurl。 ## 地图瓦片 在线瓦片地址使用 OpenStreetMap XYZ 格式: ```text https://tile.openstreetmap.org/{z}/{x}/{y}.png ``` 新下载的瓦片保存为: ```text C:\mapdata\{z}\{x}\{y}.png ``` 为兼容历史缓存,程序也会读取旧格式: ```text C:\mapdata\{z}\{x}\{y}.bmp ``` 其中标准 BMP 由 stb_image 加载;对于旧缓存中的 1 位、未压缩 BMP,`texture.cpp` 内置了解码回退逻辑,将颜色表和位图数据转换为 RGBA8 后再上传到 OpenGL。因此不会再出现: ```text stbi_load failed: ... (monochrome) ``` ## 构建 使用 Visual Studio 2017 x64 生成项目: ```powershell & 'D:\Install\CMake\bin\cmake.exe' -S . -B build -G 'Visual Studio 15 2017 Win64' & 'D:\Install\CMake\bin\cmake.exe' --build build --config Debug & 'D:\Install\CMake\bin\cmake.exe' --build build --config Release ``` 生成的程序位于: ```text build\Debug\digital_globe.exe build\Release\digital_globe.exe ``` 构建后会自动复制着色器数据目录和对应的 GLEW DLL 到输出目录。