OpenWebGlobeSDKforWebGLSpecificationWednesday,22.April2020MartinChristenmartin.christen@fhnw.chWARNINGThisisadraftspecification.Certainthingsmaystillchange-thisdraftisnotfullycompatibletofuturereleasesoftheOpenWebGlobeSDKspecification.Thisdocumentreplacesallpreviousversions.OpenWebGlobeSDK1.022.04.2020Seite2/36OpenWebGlobeSDK1.022.04.2020Seite3/36TableofContents1Introduction41.1BasicObjects41.2HelloWorld52OpenWebGlobeObjectsoverview63OpenWebGlobeFunctions73.1GeneralObjectfunctions73.2Context-Object83.3SettingContext-relatedCallbackFunctions103.4SceneObject113.4.13D-Ellipsoid-WGS84specificfunctions123.4.23D-Flat-Cartesian133.4.32D-Screen133.5CameraObject153.6TextureObject163.7NavigationControllerObject173.8WorldObject(Terrain/Globe)193.9POIObject283.9.1ImageLayer213.9.2ElevationLayer223.9.3WaypointLayer233.9.4POILayer243.9.5GeometryLayer253.9.6VoxelLayer263.10Geometry313.10.1GeometryObject313.10.2MeshObject323.10.3PointObject323.10.4LineObject333.10.5MaterialObject333.10.6CreatingDefaultObjekts333.11TextData344MiscFunctions36OpenWebGlobeSDK1.022.04.2020Seite4/361IntroductionOpenWebGlobeSDKconsistsoffunctions,butisdesignedinanobjectorientedmanner.TheSDKiswritteninC++andhasbindingstootherlanguageslikePython,C#andVisualBasicorJavaScript(WebGL).Anewapplicationcanbewritteninyourfavoritelanguage.TheSDKconsistsofserveralobjects.Eachobjectcontainsacertainnumberoffunctions.1.1BasicObjectsBecauseOpenWebGlobeSDKconsistsoffunctions,allobjectsarereferencedusinganintegerid.Amongthebasicobjectsisthecontextobjectwhichisthecombinationofarenderwindowandagraphicsengine.Aspecialmodeallowswindowlessapplications-whichisforexampleusefulforserverapplicationsorqueryengines.Thesceneobjectdescribesthetypeofvirtualglobevisualisation.Avirtualglobeisusuallyrepresentedas3d-ellipsoid(WGS84),butitisalsopossibletocreateflatearthrepresentationsespeciallyforlocalscenesortocreatea2Dvisualisationwhichisusuallya2d-map-typeapplication.Insidethescenethereisacamerawhichcontrolswhatisvisible.Therecanbeseveralcamerasinascene,butonlyoneisactiveatthesametime.Thecamerahasanavigationcontrollerwhichallowsnavigationthroughthescene-forexamplewiththemouseandkeyboardasinput.Thereisadefaultnavigationcontrolleravailableandacustomnavigationcanalsobeimplemented.Theworldobjectcontainstheglobeintheformatspecifiedinthescenebefore(ellipsoid,flat,2d).Theworldconsistsofdifferentlayerswhichcanbeaddedorremovedduringruntime.Themostimportantlayersaretheimagelayerconsistingofpreviouslytiledortho-photosandtheelevationlayerconstistingofpreviouslyprocessed(tiledgeometry)elevationdata(DEM).Bothlayersallowstreamingnearlyunlimiteddata.Thewaypointlayercontainswaypoints,forexamplepreviouslytrackedpointswithaGPSreceiver.Furthermorethepoilayercontainspointsofinterest(POI),thegeometrylayercontains3d-objectsandthevoxellayercontainspreprocessed(tiled)pointclouddata.Alllayersarestreamableovertheinternetoralsofromalocalareanetworkorlocalharddrive.OpenWebGlobeSDK1.022.04.2020Seite5/361.2HelloWorldThisexamplecreatesavirtualglobeandaddsimageandelevationdatatoit.htmllang=enmetahttp-equiv=Content-Typecontent=text/html;charset=utf-8/scripttype=text/javascriptsrc=OpenWebGlobe.js/scriptscripttype=text/javascriptfunctionmain(){varcontext=ogCreateContextFromCanvas(canvas);varglobe=ogCreateGlobe(context);ogAddImageLayer(globe,{url:['],layer:'world500'});ogAddElevationLayer(globe,{url:['],layer:'srtm'});}/scriptbodyonload=main()divstyle=text-align:centercanvasid=canvaswidth=640height=480/canvas/div/bodyThefunctionogCreateContextFromCanvasisasimplefunctiontosetuptherenderenvironment.ThereisalsoamorecomplexfunctionogCreateContextwhichprovidesmoreoptions.Thereturnvalueofthesefunctionsareanidtoacontextobject.Thisidisrequiredforotherfunctions.Itisalsopossibletouseseveralcontextsatthesametime.ThesecondfunctionogCreateGlobedirectlycreatesaWGS84scenecontainingacameraandaworldobject.Thisisaconvieniencefunctionastherearealsofunctionsavailabletocreatesceneobjects,cameraobjectsandworldobjectsmanually.Thenextfunctionsaddimage(ogAddImageLayer)andelevation(ogAddElevationLayer)layerstothescene.Thesefunctionsalsoreturnanidtotheobjectsbuttheyarenotusedforthisdemo.OpenWebGlobeSDK1.022.04.2020Seite6/362OpenWebGlobeObjectsoverviewTheOpenWebGlobeSDKforWebGLhasthefollowingobjecthierarchy:OpenWebGlobeSDK1.022.04.2020Seite7/363OpenWebGlobeFunctions3.1GeneralObjectfunctionsObjectOperationstype=ogGetObjectType(intobject);Returnsthetypeoftheobject,whichcanbeoneofthefollowing:OG_OBJECT_CONTEXT,OG_OBJECT_SCENE,OG_OBJECT_WORLD,OG_OBJECT_IMAGELAYER,OG_OBJECT_ELEVATIONLAYER,OG_OBJECT_WAYPOINTLAYER,OG_OBJECT_POILAYER,OG_OBJECT_GEOMETRYLAYER,OG_OBJECT_VOXELLAYER,OG_OBJECT_IMAGE,OG_OBJECT_TEXTURE,OG_OBJECT_PIXELBUFFER,OG_OBJECT_GEOMETRY,OG_OBJECT_MESH,OG_OBJECT_SURFACE,OG_OBJECT_CAMERA,OG_OBJECT_TEXT,OG_OBJECT_BINARYDATA,OG_OBJECT_LIGHT.OG_OBJECT_POInum=ogGetNumObjects();Returnsthenumberofallobjects.BecauseOpenWebGlobeisaDLLitispossibleseveralapplicationsuseitatthesametime.Thereforethi