Skip to content

Instantly share code, notes, and snippets.

View jasonbeverage's full-sized avatar

Jason Beverage jasonbeverage

View GitHub Profile
@jasonbeverage
jasonbeverage / generate_mappings.py
Created July 11, 2022 14:33
Generates a mappings.xml file for use with osgEarth CoverageLayer based on unique values in an attribute in a vector file.
from osgeo import ogr
import click
def get_unique_values(layer, field):
"""
Finds all the unique values in the vector layer
"""
layer.ResetReading()
@jasonbeverage
jasonbeverage / osgearth_qt.cpp
Created February 3, 2022 17:35
Multithreaded QT implementation
#include <QApplication>
#include <QEvent>
#include <QResizeEvent>
#include <QtOpenGL/QGLWidget>
#include <QTimer>
#include <sstream>
#include <osgViewer/GraphicsWindow>
#include <osgViewer/Renderer>
/* -*-c++-*- */
/* osgEarth - Geospatial SDK for OpenSceneGraph
* Copyright 2020 Pelican Mapping
* http://osgearth.org
*
* osgEarth is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
@jasonbeverage
jasonbeverage / osg_blend2d.cpp
Created August 21, 2020 17:19
Playing with blend2d in osg
#include <blend2d.h>
#include <osgDB/WriteFile>
#include <osg/Image>
#include <osg/Texture2D>
#include <osgEarth/VirtualProgram>
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <osgGA/TrackballManipulator>
#include <osg/BlendEquation>
#include <osg/BlendFunc>
@jasonbeverage
jasonbeverage / openvdb_test.cpp
Created July 1, 2020 14:43
openvdb_viewer.cpp
/* -*-c++-*- */
/* osgEarth - Geospatial SDK for OpenSceneGraph
* Copyright 2020 Pelican Mapping
* http://osgearth.org
*
* osgEarth is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
@jasonbeverage
jasonbeverage / osgearth_computeminmaxelevation.cpp
Last active January 21, 2022 15:19
Code to generate a low res index of the min/max elevation of the whole earth.
/* -*-c++-*- */
/* osgEarth - Geospatial SDK for OpenSceneGraph
* Copyright 2020 Pelican Mapping
* http://osgearth.org
*
* osgEarth is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
@jasonbeverage
jasonbeverage / gist:4d277a96e9e86f198f9eee8789fd2903
Last active November 22, 2019 15:03
Build osg and osgearth against vcpkg for my machine
# Build osg with vcpkg
cmake .. -G "Visual Studio 15 2017 Win64" -DCMAKE_TOOLCHAIN_FILE=d:\dev\vcpkg\scripts\buildsystems\vcpkg.cmake -DWIN32_USE_MP=ON -DCMAKE_INSTALL_PREFIX=d:\dev\Installs\OpenSceneGraph -DCMAKE_BUILD_TYPE=Release
cmake --build . --target INSTALL --config Release
# Build osgearth with vcpkg and local osg
cmake .. -G "Visual Studio 15 2017 Win64" -DOSG_DIR=d:\dev\Installs\OpenSceneGraph -DWIN32_USE_MP=ON -DCMAKE_TOOLCHAIN_FILE=d:\dev\vcpkg\scripts\buildsystems\vcpkg.cmake -DWIN32_USE_MP=ON -DCMAKE_INSTALL_PREFIX=d:\dev\Installs\osgEarth -DCMAKE_BUILD_TYPE=Release
cmake --build . --target INSTALL --config Release
@jasonbeverage
jasonbeverage / osg_indirect.cpp
Created August 14, 2018 15:33
Playing with multidrawindirect in osg
#include <osg/GL2Extensions>
#include <osg/Notify>
#include <osg/ref_ptr>
#include <osg/Geode>
#include <osg/Geometry>
#include <osg/Point>
#include <osg/Vec3>
#include <osg/Vec4>
#include <osg/Program>
@jasonbeverage
jasonbeverage / osg_dod.cpp
Created January 12, 2018 19:15
Playing with data oriented design ideas in OSG.
#include <osgDB/ReadFile>
#include <osgUtil/Optimizer>
#include <osg/CoordinateSystemNode>
#include <osg/Point>
#include <osg/Switch>
#include <osg/Types>
#include <osgText/Text>
#include <osgViewer/Viewer>
@jasonbeverage
jasonbeverage / osgearth_viewer_fmg.cpp
Created September 26, 2017 18:57
Little test to see if the feature model graph is being deleted.
/* -*-c++-*- */
/* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
* Copyright 2016 Pelican Mapping
* http://osgearth.org
*
* osgEarth is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*