Repository navigation
Samples
The repository has six samples in samples/: an OpenGL / OpenGL ES sample (which also builds as a web page on WebGL 2), a pure-C sample, a Direct3D 11 sample, an Ogre sample and a headless sample without a GPU. This page describes what each one shows, how to build and run it, every command-line option, the controls and the overlay panel, the small sample data set they draw, and which parts of the sample code you can copy into your own application. Every sample is also a test: run with --check, it verifies what it draws and exits with 1 on a failure.
| Sample | Executable | CMake target | Backend | Shows | Built when |
|---|---|---|---|---|---|
| OpenGL | vgl-gl |
vgl_gl_sample |
OpenGL backend, OpenGL 3.3 or OpenGL ES 3.0 | The full interactive globe with the overlay panel, navigation, imagery layers, atmosphere, stars and clouds | The OpenGL backend is on, GLFW is found or downloaded, and Dear ImGui is downloaded |
| OpenGL in a browser | vgl-gl.html |
vgl_gl_sample |
OpenGL backend on WebGL 2 | The same program as a page | The emscripten preset |
| Pure C | vgl-c |
vgl_c_sample |
OpenGL backend, OpenGL 3.3 | A minimal C99 host: a camera circling the globe | As the OpenGL sample, but not on Emscripten |
| Direct3D 11 | vgl-d3d11 |
vgl_d3d11_sample |
Direct3D 11 backend | The OpenGL sample's features in a Win32 window | Windows, with the Direct3D 11 backend and Dear ImGui |
| Ogre | vgl-ogre |
vgl_ogre_sample |
Ogre backend, OpenGL 3+ or Direct3D 11 render system | The globe in an Ogre 14 scene, with the same controls and panel |
VGL_BACKEND_OGRE is on and GLFW is available |
| Headless | vgl-headless |
vgl_headless |
None: a consumer that only counts resources | A scripted flight from orbit to 10 km, with statistics per view, credits and height queries | Always, when the defaults module is built |
All samples use the defaults module (thread pool, file reader and, when built, the HTTP reader and disk cache), so samples/CMakeLists.txt adds none of them when vgl_defaults is not built.
The samples are built when VGL_BUILD_SAMPLES is on, which it is by default when vgl is the top-level project. See Building vgl for the presets.
| CMake option | Default | Effect on the samples |
|---|---|---|
VGL_BUILD_SAMPLES |
On when top level | Builds the samples |
VGL_BUILD_DEFAULTS |
On | Required by every sample |
VGL_FETCH_DEPENDENCIES |
On | Downloads GLFW (if not installed) and Dear ImGui. With it off, only an installed GLFW is used, and the OpenGL, Direct3D 11 and Ogre samples, which need Dear ImGui, are skipped |
VGL_BACKEND_GL |
On | The OpenGL and pure-C samples |
VGL_BACKEND_D3D11 |
On on Windows | The Direct3D 11 sample |
VGL_BACKEND_OGRE |
Off | The Ogre sample. An installed Ogre 14 is used, or else Ogre 14.6.1 is downloaded and built |
VGL_DEFAULTS_HTTP |
Off (on in the windows-msvc-shared preset) |
Lets --pack take http:// and https:// URIs, and makes --cache useful |
VGL_BUILD_TESTS |
On when top level | Registers the samples' checks as tests (below) |
VGL_TEST_GL |
Off | Registers the checks that need a display: gl, gl_es, gl_c, ogre_gl and ogre_d3d11
|
VGL_TEST_BROWSER |
Off | In the emscripten build, registers the browser test of the page (needs Chrome and Caddy) |
Sample-only dependencies, which the library itself never uses:
| Dependency | Used by | Where it comes from |
|---|---|---|
| GLFW 3.4 | OpenGL, pure-C and Ogre samples | An installed GLFW 3.3 or later (find_package(glfw3)), or else downloaded at a pinned version with a checked hash and built as a static library. On Emscripten, Emscripten's GLFW port (--use-port=contrib.glfw3) |
| Dear ImGui 1.92.9b | The overlay of the OpenGL, Direct3D 11 and Ogre samples | Downloaded at a pinned release with a checked hash (cmake/vgl_imgui.cmake). The Ogre sample uses the copy that Ogre's overlay compiles |
| Ogre 14 | Ogre sample | Installed, or Ogre 14.6.1 downloaded (see Ogre backend) |
| stb_image (private copy) | The clouds helper (vgl_sample_clouds) |
The same pinned stb_image.h the library uses |
Android and iOS build no interactive sample, since GLFW and the overlay are for desktops. The headless sample builds everywhere.
Build with a preset and find the executables in build/<preset>/bin/<configuration>/:
cmake --preset windows-msvc-shared
cmake --build --preset windows-msvc-shared-release
build\windows-msvc-shared\bin\Release\vgl-gl.execmake --preset linux-gcc-shared
cmake --build --preset linux-gcc-shared-release
build/linux-gcc-shared/bin/Release/vgl-glOn Windows with shared libraries, vgl.dll, vgl-defaults.dll, vgl-gl.dll and vgl-d3d11.dll are written next to the executables, so the samples run from the build directory without further setup. See Troubleshooting if a DLL is missing.
Every sample reads packs through the defaults module. Without options, it draws the sample data set from:
- the directory given with
--data, or else - the directory in the environment variable
VGL_SAMPLE_DATA, or else - the source tree's
samples/data, built into the executable asVGL_SAMPLE_DATA_DIR.
--pack <uri>, repeated, replaces the sample set with the packs named, in the order given. They all get priority 0, so each pack wins over the ones before it where they overlap (samples/common/sample_data.hpp). A URI is the pack's directory (the one holding pack.vglm), on disk or, when vgl is built with VGL_DEFAULTS_HTTP, on a web server. --pack cannot be combined with --data or --check. Without the HTTP reader, the C++ samples print a warning for each http:// or https:// pack, which then fails to load.
The sample set is added with these priorities: GEBCO (0), GLO-30 Sognefjord (1), EGM2008 geoid (0), Blue Marble (0), Sentinel-2 Sognefjord (1). The pure-C sample loads only GEBCO, the geoid and Blue Marble.
The C++ samples share most options. A sample prints its usage and exits with 2 on an unknown or incomplete option.
| Option | vgl-gl |
vgl-d3d11 |
vgl-ogre |
vgl-headless |
vgl-c |
Meaning |
|---|---|---|---|---|---|---|
--data <directory> |
Yes | Yes | Yes | Yes | Yes | The directory of the sample set |
--pack <uri> |
Yes | Yes | Yes | Yes | Yes (up to 16) | A pack to draw instead of the sample set; repeat it for more |
--cache <directory> |
Yes | Yes | Yes | Yes | No | Puts a disk cache in front of the HTTP reader, which keeps what comes from web servers for next time and for offline use. Needs VGL_DEFAULTS_HTTP
|
--cache-budget <MiB> |
Yes | Yes | Yes | Yes | No | The disk cache's budget in mebibytes, a whole number from 1; 1024 by default |
--depth logarithmic|reversed|conventional |
Yes (default logarithmic) |
Yes (default reversed) |
Yes (default reversed) |
No | No (logarithmic) | The depth convention |
--stars <catalog> |
Yes | Yes | Yes | No | No | Draws the real sky from the Yale Bright Star Catalogue (see Stars) instead of generated stars |
--check |
Yes | Yes | Yes | Yes | Yes | Runs the sample's checks and exits with 1 on a failure. Needs the sample set |
--save <directory> |
Yes | Yes | Yes | No | No | With --check, writes the images it checks as PPM files |
--es |
Yes | Uses an OpenGL ES 3.0 context instead of OpenGL 3.3 core | ||||
--egl |
Yes | Creates the context through EGL (GLFW_EGL_CONTEXT_API) |
||||
--warp |
Yes | Draws with WARP, Direct3D's software rasterizer | ||||
--rs gl|d3d11 |
Yes (default gl) |
Ogre's render system: OpenGL 3+ or Direct3D 11 |
Examples:
# The sample set, on OpenGL ES 3.0, with reversed-Z (needs GL_EXT_clip_control).
vgl-gl --es --depth reversed
# Your own packs from a web server, cached on disk within 4 GiB.
vgl-gl --pack https://packs.example.org/gebco --pack https://packs.example.org/glo30 \
--cache ~/.cache/vgl --cache-budget 4096
# The Ogre sample on Ogre's Direct3D 11 render system.
vgl-ogre --rs d3d11
# The headless check, as the headless test runs it.
vgl-headless --check --data samples/dataThe interactive samples navigate in the style of Google Earth, with the navigation they share in samples/common/navigation.hpp. The GLFW samples (OpenGL, Ogre) map their input in samples/common/glfw_controls.cpp; the Direct3D 11 sample maps the same keys from Win32 messages.
| Input | Action |
|---|---|
| Left drag | Grab the globe: the point under the cursor stays under it. Released while moving, the globe is thrown and slows down. Over space, the drag spins the globe like a disk facing the screen, and switches between the two where the cursor crosses the globe's edge |
| Scroll | Zoom towards the point under the cursor |
| Double-click (left) | Zoom towards the point under the cursor |
| Shift + left drag, or middle drag | Orbit around the point under the cursor: sideways turns, up and down tilts. Pressed over space, nothing |
| Ctrl + left drag | Look around from where the camera is |
| Right drag | Zoom by dragging up and down |
Movements that start at the cursor pick the terrain under it with vgl_context_ray_query, so the grabbed point stays under the cursor even over mountains. A reticle shows the point that an orbit or zoom turns around, fading out half a second after the movement ends.
| Key | Action |
|---|---|
| Arrows or W, A, S, D | Move over the ground |
| Shift + arrows or W, A, S, D | Turn and tilt around the point at the centre of the view |
Page Up, Page Down (also = / - and keypad + / -) |
Zoom |
| N | Turn north up |
| U | Look straight down |
| R | North up and straight down |
| 1 to 7 | Fly to a place (below) |
| L | Switch between sunlight and a headlight |
| F1 | Show or hide the panel; while it is hidden, the button "vgl (F1)" in the corner also brings it back |
| F2 | Wireframe (VGL_DEBUG_VIEW_WIREFRAME) |
| F3 | Colour by tile level (VGL_DEBUG_VIEW_LEVEL_COLORS) |
| F4 | Imagery source: orange for coarser imagery, magenta for none (VGL_DEBUG_VIEW_IMAGERY_SOURCE) |
| F5 | Freeze the selection: tiles stay selected for the frozen camera, whose frustum is outlined, while you fly around it |
| F6 | Colour by height instead of imagery (VGL_DEBUG_VIEW_HEIGHT_COLORS) |
| F7 | Contour lines (VGL_DRAW_FEATURE_CONTOURS) |
| F8 | Sea surface over the ocean floor (VGL_DRAW_FEATURE_SEA_SURFACE) |
| F9 | Atmosphere (VGL_DRAW_FEATURE_ATMOSPHERE) |
| Escape | Quit |
The keys and mouse are ignored while the panel has the keyboard or mouse. The flights of keys 1 to 7 and N, U and R follow a great circle and rise in an arc over long distances, taking from half a second to about four seconds.
Defined in samples/common/sample_check.hpp; the --check runs visit the same places.
| Key | Place | Latitude, longitude | Altitude |
|---|---|---|---|
| 1 | Orbit, Atlantic | 30, -30 | 20,000 km |
| 2 | Europe | 48, 10 | 5,000 km |
| 3 | Alps | 44.5, 9 | 300 km |
| 4 | Himalaya | 26, 86.9 | 60 km |
| 5 | Mid-Atlantic Ridge | 20, -50 | 1,500 km |
| 6 | Sahara | 23, 12 | 1,000 km |
| 7 | Sognefjord | 61.1, 6.2 | 4 km |
The Sognefjord is where the sample set has its detailed terrain (GLO-30) and imagery (Sentinel-2 cloudless 2016).
The OpenGL, Direct3D 11 and Ogre samples share an overlay drawn with Dear ImGui (samples/common/overlay.hpp). It is independent of the window and graphics API: each sample passes hooks for Dear ImGui's platform and renderer backends (sample::overlay::backend). The panel, titled "vgl (F1)", shows:
- the graphics API and version, the device, the depth convention, and a plot of frame times;
-
Debug views: check boxes for the F2 to F9 views, plus Stars, Clouds, the contour interval (automatic from the altitude, or set by hand), Sunlight with the time of day (UTC), day of year and year, or the current time from the system clock, and the maximum screen-space error (0.5 to 16 pixels,
vgl_view::max_screen_space_error); -
Imagery layers: each imagery pack with a visibility check box, up and down arrows that reorder the layers (
vgl_pack_priority_set) and an opacity slider (vgl_pack_opacity_set); -
Memory: CPU and GPU use against their budgets (
cpu_used/cpu_budget,gpu_used/gpu_budget), and the disk cache's when there is one; -
Disk cache (with
--cache): entries, hits and misses, hit rate, offline manifests and evictions (vgl_disk_cache_statistics); - Tiles and resources: tiles selected and drawn, vertices and triangles, packs loading and failed, reads outstanding, tiles decoding and cached, meshes building and waiting, textures decoding and waiting, resources resident, created and destroyed in the last frame;
- Times and totals: update and frame times, mean tile load time, reads, bytes read, tiles loaded;
- Camera: the live camera and, while frozen, the frozen one;
- Controls: a summary of the controls above;
-
Credits: the lines of
vgl_context_attribution_getfor the data in view.
The interactive samples start with the atmosphere, stars and clouds on. The window title shows the depth convention, frames per second, tiles drawn, GPU memory and altitude. On exit, vgl-gl prints the credits of what was last in view, as a host would show them.
samples/gl/main.cpp is the reference integration of the OpenGL backend. The host (the sample) owns the GLFW window, the OpenGL context, the camera and the framebuffer; vgl draws into it. It creates an OpenGL 3.3 core context, or with --es an OpenGL ES 3.0 context, and draws into a framebuffer of its own, with a 32-bit floating-point depth buffer for reversed-Z, which it then copies to the window. It shows the sequence every host follows:
- Create a
vgl::thread_pooland a reader (sample::pack_reader: avgl::file_reader, with avgl::http_readerandvgl::disk_cachein front when available). - Create the context with the pool's task interface, the reader's I/O interface, a log callback and
VGL_LOG_LEVEL_INFO. - Add the packs with
vgl::pack::create. - Set the clip control depth mode for the convention, then create the backend with
vgl::gl_backend::create, and give it stars (stars_set) and clouds (clouds_set). - Each frame: query the height under the camera for the navigation, set the view, update the context, clear, draw with the backend, draw the overlay, swap.
- On exit, destroy in order: the backend while its OpenGL context exists, the packs, the context, the reader, the pool, and last the window.
With the reversed-Z convention, the device must support clip control; otherwise the sample prints "the reversed-Z convention needs clip control, which this device lacks" and exits.
--check runs hidden at 640 x 360: for each depth convention the device supports, it flies to the seven places, waits until loading settles (sample::idle: nothing loading, building or uploading, and every selected tile drawn), and checks that the globe covers the expected share of the view, that the Sahara is sand-coloured, that the conventions draw the same image where they resolve depth well, that OpenGL reports no errors and that the backend restores the host's OpenGL state. It also checks that the navigation keeps a grabbed point under the cursor to within a pixel. With --save, the checked images are written as PPM files.
The same program builds with Emscripten into vgl-gl.html (with vgl-gl.js, vgl-gl.wasm and vgl-gl.data, which holds the clouds' image), drawing with WebGL 2. Build the emscripten preset with emsdk 6.0.11:
cmake --workflow --preset emscripten-release
caddy run --config samples/gl/web/Caddyfile
# Open http://localhost:8090/vgl-gl.htmlThe page runs threads, so it must be served cross-origin isolated, with Cross-Origin-Opener-Policy: same-origin and Cross-Origin-Embedder-Policy: require-corp. samples/gl/web/Caddyfile does this, and serves the sample packs at data/packs next to the page. The environment variables VGL_SITE (default :8090), VGL_WEB (default build/emscripten/bin/Release) and VGL_PACKS (default samples/data/packs) change the address, the page's directory and the packs' directory.
Options come from the page's address: a parameter with a value passes --name value, one without passes --name. For example vgl-gl.html?pack=https://packs.example.org/gebco&pack=https://packs.example.org/glo30&depth=conventional. Relative pack URIs are fetched relative to the page; packs on another server need CORS. --check is not available in the page. Reversed-Z is not available either, since WebGL 2 has no clip control. Supported browsers are Chrome and Edge 92, Firefox 79 and Safari 15.2, or later. See Web builds and samples/gl/web/README.md.
samples/c/main.c is the OpenGL sample's core in C99, written only against the C API: the shortest complete integration. It creates a thread pool and file reader from the defaults module, a context, three packs (GEBCO, the geoid and Blue Marble), and an OpenGL backend on a GLFW OpenGL 3.3 context, then circles the globe at 20,000 km once a minute. Escape quits. It has no overlay, navigation, atmosphere or stars.
vgl-c [--data <directory> | --pack <uri>...] [--check]With --check, it runs hidden until the view has loaded and checks that every selected tile is drawn, no pack failed and OpenGL reports no error. Read it alongside Getting started and Context API.
samples/d3d11/main.cpp draws with the Direct3D 11 backend in a plain Win32 window, with the same controls, places and overlay as the OpenGL sample (the overlay through Dear ImGui's Win32 and Direct3D 11 backends). The host owns the window, device, camera and render targets. It uses the hardware device, or WARP with --warp or when no hardware device is available. Its default depth convention is reversed-Z.
With --check, it runs without a window: it draws the places offscreen with each depth convention and checks what it draws, that the conventions agree, that the backend restores the host's device context state, and that it draws again after a device reset. Since WARP is on every Windows machine, its d3d11 test needs no GPU or display and is registered whenever tests are built.
samples/ogre/main.cpp puts the globe in a classic Ogre 14 scene with the Ogre backend. GLFW owns the window and input, with the same controls as the OpenGL sample; Ogre draws into it (through externalWindowHandle on Windows and as a child X11 window, parentWindowHandle, on Linux). The panel is the shared overlay, drawn by Ogre's own Dear ImGui overlay. It needs Ogre's Media/Main and Media/RTShaderLib directories, which the build points it to (VGL_OGRE_MEDIA_DIR), and writes Ogre's log to vgl-ogre.log in the working directory.
--rs gl (default) selects "OpenGL 3+ Rendering Subsystem" and --rs d3d11 "Direct3D11 Rendering Subsystem"; if Ogre has no such render system, the sample prints "Ogre has no ... render system here". The default depth convention is reversed-Z, through the render system's "Reversed Z-Buffer" option. Since Ogre's render windows keep a 24-bit integer depth buffer even then, the sample draws the globe into a render texture with a 32-bit floating-point depth buffer and shows that.
With --check, it draws the places offscreen with each depth convention, starting a new Ogre root for each (reversed-Z is a render system option), and checks the images and that the conventions agree. The tests ogre_gl and, on Windows, ogre_d3d11 need a display and are registered with VGL_TEST_GL.
samples/headless/main.cpp uses only the public API and the defaults module, without a GPU. It flies a scripted camera through seven views (orbit over the Atlantic, 5,000 km over Europe, 1,000 km and 100 km over the Alps, 10 km over the Himalaya, 20 km over the Sognefjord, orbit over the Pacific), and in each view updates the context and takes frames until loading settles. A small consumer class "creates" the resources each vgl::frame offers and keeps their sizes, which is a good template for an engine integration's bookkeeping (see Render interface). For each view it prints frames, update and frame times, tiles selected and drawn, and memory; then the credits; then heights above the ellipsoid and above mean sea level at well-known places.
vgl-headless [--data <directory> | --pack <uri>...] [--cache <directory> [--cache-budget <MiB>]] [--check]With --check, it verifies that loading settles, no pack fails, every selected tile is drawn with imagery, the consumer holds what the core counts, both budgets hold, GEBCO and Blue Marble are credited, and the heights are plausible. It is the headless test on every platform, and on Emscripten it runs on Node.js. The reference server's check (tools/server/check.sh) uses it to load packs over HTTP; see Reference server.
| Test | Command | Registered when |
|---|---|---|
headless |
vgl_headless --check --data samples/data |
VGL_BUILD_TESTS |
d3d11 |
vgl_d3d11_sample --check --data samples/data |
VGL_BUILD_TESTS, on Windows |
gl, gl_es
|
vgl_gl_sample --check [--es] --data samples/data |
VGL_BUILD_TESTS and VGL_TEST_GL
|
gl_c |
vgl_c_sample --check --data samples/data |
VGL_BUILD_TESTS and VGL_TEST_GL
|
ogre_gl, ogre_d3d11
|
vgl_ogre_sample --check --rs gl|d3d11 --data samples/data |
VGL_BUILD_TESTS and VGL_TEST_GL (D3D11 on Windows only) |
browser |
tests/browser/page_check.mjs in headless Chrome, served by Caddy |
emscripten build with VGL_TEST_BROWSER
|
cmake --preset linux-gcc-shared -DVGL_TEST_GL=ON
cmake --build --preset linux-gcc-shared-release
ctest --preset linux-gcc-shared-release -R "^(gl|gl_es|gl_c|headless)$"CI runs the display checks on Linux under Xvfb with Mesa.
samples/data holds small packs that let the samples and their tests run offline. They are far too coarse for anything but samples and tests, and the project hosts no data: bake your own packs with the Baker and host them yourself (Hosting packs).
| Pack | Contents | Levels | Size |
|---|---|---|---|
packs/gebco |
GEBCO 2026 grid: land and ocean floor, as ellipsoidal heights | 0 to 3 (about 20 km between samples) | 3.4 MB |
packs/egm2008 |
EGM2008 geoid, for heights above mean sea level | 0 to 2 (about 0.7 degrees) | 0.7 MB |
packs/glo30-sognefjord |
Copernicus DEM GLO-30 over the Sognefjord, Jostedalsbreen and the western Jotunheimen (5.625 to 8.4375 E, 60.46875 to 61.875 N) | 7 to 11 (about 76 m) | 10.9 MB |
packs/bluemarble |
NASA Blue Marble: Next Generation, July, with topography and bathymetry, 256-pixel JPEG tiles | 0 to 3 (about 10 km per pixel) | 1.6 MB |
packs/s2cloudless-sognefjord |
Sentinel-2 cloudless 2016 by EOX over the GLO-30 region, 256-pixel JPEG tiles | 7 to 11 (about 38 m per pixel) | 12.5 MB |
clouds.jpg |
NASA Blue Marble cloud composite (2002), grey, 4096 x 2048, for the backends' cloud shell. Its ice sheets over Antarctica and Greenland show as cloud | 2.7 MB |
Each pack is a single base shard. Two known artefacts: the Sentinel-2 2016 mosaic has a flat near-black fill (RGB 11, 18, 26) over Jostedalsbreen and other glaciers that its processing took for cloud, and the GLO-30 pack is baked without sea_blend, so its edges show the change of resolution to the coarse GEBCO sample.
The bake configurations (gebco-sample.json, egm2008-sample.json, glo30-sample.json, bluemarble-sample.json, s2cloudless-sample.json) are next to the packs, and samples/data/README.md describes where each source came from and how to bake them again with vgl-bake bake <configuration>. Bakes are deterministic.
Each pack carries its source's attribution in its metadata, which the samples show under Credits while that pack's data is in view (the geoid pack's whenever any terrain is). If you redistribute the sample data, keep the credits; see Attribution and licensing for the exact lines and licenses. clouds.jpg is not a pack, so its credit ("NASA Earth Observatory, Blue Marble: Clouds (Reto Stöckli)") is not reported by the runtime.
vgl ships no star catalogue: backends draw the stars the host gives them (vgl_star, see Atmosphere, stars and clouds). The samples' helper, samples/common/stars.hpp, provides:
-
sample::generated_stars(): a deterministic random sky of 8,800 stars down to magnitude 6.5, with about as many of each magnitude as the real sky, coloured blue-white to orange, with more faint stars towards a Milky Way band, but no real constellations; -
sample::catalog_stars(path, out, error): a reader for the Yale Bright Star Catalogue, 5th revised edition, in its original text form (the filecatalogof CDS catalogue V/50,https://cdsarc.cds.unistra.fr/ftp/V/50/catalog.gz, decompressed), with J2000 positions, visual magnitudes and B-V colours of its 9,110 entries. The repository does not hold it: download it yourself and pass it with--stars; -
sample::earth_rotation_angle(time_of_day, day_of_year, year)andsample::current_time_get(...): the Earth rotation angle for a UTC time, throughvgl_earth_rotation_angle_get, for the draw'searth_rotation_angle.
samples/common/clouds.hpp: sample::clouds_load(directory, error) reads clouds.jpg from the sample set's directory with stb_image into a one-byte-per-pixel coverage image (rows from the north), and sample::sky_clouds() returns it for the backend's clouds_set. If the file is missing, the interactive samples print "no clouds: ..." and run without clouds. A host can pass any grey equirectangular coverage image within VGL_CLOUD_IMAGE_SIZE_MIN to VGL_CLOUD_IMAGE_WIDTH_MAX x VGL_CLOUD_IMAGE_HEIGHT_MAX pixels.
The sample code is MIT-licensed like the rest of vgl. Parts that are designed to be reused:
| File | What it gives you | Dependencies |
|---|---|---|
samples/common/sample_camera.hpp |
A camera over the globe (latitude, longitude, altitude, heading, pitch), look_at, perspective and perspective_reversed (reversed with an infinite far plane) as vgl_dmat4
|
vgl only |
samples/common/navigation.hpp |
sample::globe_navigation: Google Earth style grab, spin, throw, orbit, look, zoom to cursor, key movement and fly_to, with terrain picking through vgl_context_ray_query
|
vgl only; no window or graphics API |
samples/common/glfw_controls.hpp |
GLFW callbacks that drive the navigation and debug keys | GLFW, the overlay |
samples/common/pack_reader.hpp |
A file reader with the HTTP reader and disk cache chained in front, choosing what is available | Defaults module |
samples/common/sample_data.hpp |
Pack lists with priorities, and the --data / VGL_SAMPLE_DATA lookup |
None |
samples/common/stars.hpp, clouds.hpp
|
Stars and a cloud image for the backends, and the Earth rotation angle | stb_image for the clouds |
samples/common/overlay.hpp |
A statistics and debug panel, with sample::sun_direction, debug_views and draw_features helpers |
Dear ImGui |
The consumer class in samples/headless/main.cpp
|
Applying a frame's destroy and create lists and tracking resource sizes | vgl only |
These are samples, not part of vgl's API: they live in namespace sample, are not installed, and may change at any time. Copy them into your project rather than linking vgl_sample_common.
- Getting started: the first globe on screen
- OpenGL backend, Direct3D 11 backend, Ogre backend
- Web builds
- Troubleshooting
Getting vgl
Using the library
Rendering
Data
Reference
Specifications