Re: Constructing Skybuck's UFO Alert Tool
Skybuck Flying <[email protected]> Wed, 3 Aug 2022 07:49:47 -0700 (PDT)
| Newsgroups | alt.comp.lang.borland-delphi |
|---|---|
| Message-ID | <[email protected]> |
******************************************************************************************************************************************** Day 3, 3 august 2022, Trying to understand H3 indexing/coordinate systems + Investigated possibility of rendering a sphere/earth with OpenGL ******************************************************************************************************************************************** 3.0 Trying to understand how H3 indexing works, it has multiple coordinate systems, it could get quite complex, I don't yet fully grasp the coordinate systems, so this shall require some more studieing and experimenting. https://h3geo.org/docs/core-library/coordsystems/ https://h3geo.org/docs/core-library/geoToH3desc https://h3geo.org/docs/core-library/h3ToGeoDesc/ https://h3geo.org/docs/core-library/h3ToGeoBoundaryDesc Further clarifications about coordinate systems may be found here: https://github.com/uber/h3-js/issues/84 3.1 Custom OpenGL was tried, by missing 3D perspective matrices. 3.1.1 Experiment with threaded renderer/opengl, surprisingly it worked somewhat. First a custom opengl renderer was tried, but I more or less discovered that OpenGL does not seem to apply 3D effect automatically. To create the 3D effect some kind of perspective matrices must be computed/created which is very boring to do, so I decided to investigate GLScene which has already implemented all of this. 3.1.2 Investigated the possibility of creating custom 3D perspective matrix, but just boring and waste of time for now, maybe in future. This man explains how to create those 3D perspective matrices as well as other youtube videos/links. Basically it's a sign to use GLScene and avoid all that work. However GLScene might throw some exceptions in the future and then maybe a custom renderer could be tried to avoid that those problems, or hack GLScene instead to fix those exceptions, so far GLScene seems promising. https://www.youtube.com/watch?v=LhQ85bPCAJ8 as well as this: https://www.youtube.com/watch?v=U0_ONQQ5ZNM 3.2 Switch to GLScene library which has lots of support classes/components for working with 3D scenes and OpenGL. 3.2.1 Downloading GLScene (I downloaded and used the zip file (GLScene_v2.1_VCL_Win32_Win64) from sourceforge) http://glscene.sourceforge.net/wikka/ https://sourceforge.net/projects/glscene/files/latest/download https://github.com/GLScene 3.2.3 Installing GLScene Following the installation guide/pdf allowed me to install GLScene flawlessly, it is not necessary to copy any DLLs into the windows system folder, I also highly recommend not to do this. These DLLs if used for for example sound and such should later be distributed with the application anyway. So it's good to be able to test what the effect would be if the DLLs are missing. The only real step required to install GLScene is to add the source folder to the library path inside Delphi and then open the GLScene.groupproj and choose compile all, then per BPL/DT (design time) install it into the Delphi environment, only GLScene_DT needs to be installed to get GLSCene/OpenGL working, the rest is optional for additional functionality. ..\GLScene\Help\InstallationGLS.pdf 3.2.4 Compiling/building GLScene Delphi compiler is lightning fast and compiled GLScene pretty quickly, in about a minute or less. C/C++ would have taken forever ! LOL GLScene consists out of at least 2.7 million lines of code. The earth's executable size was still below 4 megabyte which for now for me at least is acceptable. The GR32 RT (runtime) and DT (design time) BPL did not compile due to missing code for GR32 which is a graphics32 library but this code is not necessary. Only GLScene RT and DT where installed for now. ( Installing and compiling/building GR32/Graphics32 might speed up the application even further, but might also introduce some more complexity and potential for bugs, but could be tried, the source code was somewhat hard to find, but can be found here: https://github.com/graphics32/graphics32 ). 3.2.5 Testing GLScene thanks to quick start guide Following this very simple quick start guide proved that GLscene can work: https://www.ibrtses.com/opengl/glscene_quickstart.html 3.2.6 I came across a "Earth" advanced demo which could be perfect for Skybuck's UFO Alert Tool. While browsing the GLSCene website and it's demos/examples I came across this "Earth" advance demo which is awesome it even has sky light scattering. ..\GLScene\AdvDemos\Earth GLScene (version GLScene_v2.1_VCL_Win32_Win64) has a very good advanced demo of Earth and it should be just fine for Skybuck's UFO Alert Tool. And GLScene is necessary to get some "3D" look, otherwise it would be necessary to implement perspective matrices which is very boring for me to do. The software rendering mode was tried and does work, it is possible to set it. Though the earth advance demo does produce some integer overflow and range check errors in software mode. The advanced earth demo renders some sky/light scattering thingy, not sure if this is the cause of it. Most likely the real cause is some kind of texturing issue and mipmapping issue that might not work so well in software rendering mode. (I report this issue on github and also on the sourceforge page of GLScene, maybe somebody will fix it, but I doubt it for now.) Most likely it is possible to re-create this earth demo step by step to see how far it will work in software rendering mode. (Perhaps an option can be added to switch to software rendering mode for the user, however this should be in some ini file/text based so user can change it in case of problems starting up the application and/or the software should automatically fall back to software rendering mode in case of problems however GLScene already claims to do that so should be ok. In my case the GPU is half broken and it did not automatically switch to software rendering mode, which in my case allowed me to at least run the demo to get some kind of impression on this broken GPU.) Discovering this advanced demo of Earth and the usage of GLScene will most likely seriously reduce my development time for this UFO Alert Tool. That is the power of Delphi ! =D Quality code as your fingers tips ! ;) =D Maybe this will be helpfull in the future perhaps for routing network to figure some things out, for now I include it in this log: https://stackoverflow.com/questions/7705228/hexagonal-grids-how-do-you-find-which-hexagon-a-point-is-in Not sure if this will be usefull, maybe: HexASCII: a file format for cartographical hexagonal rasters file:///C:/Users/new/Downloads/HASC.pdf *New* Construction of Skybuck's UFO Alert Tool Playlist: https://youtube.com/playlist?list=PL0HGds8aHQsB47NC9ESZrG5r8WUvg8gU6