Write in front
Recently, boss asked to embed the current osggis effect into the web page. After tossing for more than a week, it was finally done.
Let’s start with our own environment: the system is window10, OSG version is 3.4, QT version is 5.9, and vs2017 compilation project is 64 bits.
I read a lot of blog posts on the Internet before, and the overall process is similar, but those articles have a common feature. They are old, and most of them are 32-bit software. There should be no problem embedding web pages with vs + QT. But now all the programs developed by ourselves are 64 bit programs, which are very different from the technical route of predecessors.
Of course, the general idea is still:OSG is embedded in QT and QT is embedded in web pages, so as to realize the combination of OSG and web pages (IE kernel)。
Activeqt server plug-in
Using vs + QT to build an ActiveX project does not need to be detailed. First, the previous map:
By always choosing the default, you can build an overall activeqt framework.
The first line of ID number is inhtmlIn the document[Objet]The value of the object.
OSG embedded QT
For the combination of OSG and QT, you can see the official examples given by OSGosgviewerQT。
(the code has been uploaded to GitHub)
Difficult ie (key)
After making the 64 bit activeqt control, opening it directly with IE will probably not load successfully. By default, when you open the IE browser, you can directly open the 32-bit (you can find IExplore — open file location confirmation through the window explorer). Even if you select 64 bit, it will not succeed in general. This is also the place where you are stuck.
Quoted from an online passage: “after IE browser opens multiple tabs at the same time, windows will run multiple different iexplore.exe processes at the same time. This phenomenon is not an abnormal fault, but the” loose coupled IE “introduced by IE browser in IE 8 and subsequent versions.” Process management technology. This technology allows IE browser to use different and separate IExplore for main window and tab Exe processes are separated. If a tab encounters problems and needs to be closed, it can avoid affecting the whole IE browser main window and other tabs. This helps to improve the stability and security of IE browser. “
That is, when makinghtmlAfter that, even if you choose to open it with 64 ie, at least two threads will be started. Viewing method: open an IE Web page, select “task manager” and select “ie go to details”, as shown in the figure: (generally, you will see two processes, one is 64 bit open and the other is 32-bit ie open by default)
Now, what we need to do is to set ie single process 64 bit startup. There are two methods:
Ie single process startup method 1:
Run gpedit MSc group policy manager. Open “tab process growth” in “computer configuration – management template – windows components – Internet explore”, set it to enabled, and the tab process growth is 0. After application, ie will enter single process mode. At this time, use IExplore. In the C: program filesinternet explore directory Exe (ie in this directory is 64 bit), open the HTML file that calls the 64 bit control, and you can successfully call the 64 bit control.
Ie single process startup method 2:
If the above method fails, you can (Baidu experience)https://jingyan.baidu.com/art…