zak
04-08-2009, 09:03
Hi
i have found a page in wich the author provide a source code to build an activeX ocx/dll to display an opengl graphics in the internet explorer.
download the source from here:
http://www.sulaco.co.za/opengl_project_OpenGL_ActiveX.htm
it is written in the old delphi 7 (year 2002)
1) i was not able to run the online version, but the offline version are working okay: just copy the prebuilt ActiveGLProject.ocx to windows\system32 (in windows xp) then register the control:
regsvr32.exe ActiveGLProject.ocx
then run the supplied page ActiveGL.htm in the internet explorer, agree when the security warning appears. you will see a rotating figure.
2) of course we can't compare displaying opengl in this way with the recent addition in thinbasic ie: merging opengl with the canvas as in the marvelous example supplied by Petr here:
http://community.thinbasic.com/index.php?PHPSESSID=4c4c607df4d9334cc37253948ce3ecbd&topic=2423.msg18277#msg18277
the later is extrememly stable and without flickering and can be managed by keys/mouse...if we want .
but for the fun only, we can play with the supplied source code above even if we do not know Delphi language, : the target is to display a rotating pyramid in the webbrowser using the code by Petr in his recent response to martin.
1- open the file ActiveGLImpl1.pas in notepad the replace all the code between glBegin(.....); and glEnd; with the pyramid code:
or whatever you want.
2 - use an old version of Delphi 7 enterprise, install it temporary for the testing purposes only, and click file -> open project, then open the ActiveGLProject.dpr you will see in this file a line {$E ocx}, but if you want a dll change it to {$E dll} then save it.
3 - click in the menu Project -> Compile ActiveGLProject then Build ActiveGLProject. and you will see in the source code folder either an ActiveGLProject.ocx or ActiveGLProject.dll upon your choice.
4 - copy the ActiveGLProject.dll to the windows\system32 folder then register it, every time you want to test another ocx/dll you must unregister it like this :
regsvr32.exe -u ActiveGLProject.dll
then copy the new one and register it again.
i do not know the delphi language, this is just like walking during a sleep.
attached the thinbasic program (the same one by Petr: just it is opening the ActiveGL.htm instead of google.com , together with the slightly modified delphi source and the activex dll, register it before running the thinbasic program.
it is interesting to note that there is no security warning when running the activex ocx/dll from the webbrowser control. there are many many ideas and suggestions concerning displaying opengl in the webbrowser. one of them is to be able to supply the htm code within the thinbasic code instead of running the htm page. second is to make a generic activex dll which will accept the opengl code from the thinbasic code something like the oxygen approach or another possible approaches.
i forgot to say that in the thinbasic code :
WebBrowser_Navigate2(cbhndl, %ID_WEB1, "ActiveGL.htm")
i can't run the ActiveGL.htm file until i specify it's complete path, so to copy the file into c:\ then the code is:
WebBrowser_Navigate2(cbhndl, %ID_WEB1, "c:\ActiveGL.htm")
the second is working.
i do not know if this is a BUG or not, since it may be the webbrowser control designed to display http://www.... and not the local htm files.
here is what you should see:
http://img35.imageshack.us/img35/9669/pyramid2n.jpg
For other Delphi Fun codes ;maths,physics,puzzles...look here:
http://www.delphiforfun.org/programs/index.htm
free source code with executables, written by old version of Delphi
i have found a page in wich the author provide a source code to build an activeX ocx/dll to display an opengl graphics in the internet explorer.
download the source from here:
http://www.sulaco.co.za/opengl_project_OpenGL_ActiveX.htm
it is written in the old delphi 7 (year 2002)
1) i was not able to run the online version, but the offline version are working okay: just copy the prebuilt ActiveGLProject.ocx to windows\system32 (in windows xp) then register the control:
regsvr32.exe ActiveGLProject.ocx
then run the supplied page ActiveGL.htm in the internet explorer, agree when the security warning appears. you will see a rotating figure.
2) of course we can't compare displaying opengl in this way with the recent addition in thinbasic ie: merging opengl with the canvas as in the marvelous example supplied by Petr here:
http://community.thinbasic.com/index.php?PHPSESSID=4c4c607df4d9334cc37253948ce3ecbd&topic=2423.msg18277#msg18277
the later is extrememly stable and without flickering and can be managed by keys/mouse...if we want .
but for the fun only, we can play with the supplied source code above even if we do not know Delphi language, : the target is to display a rotating pyramid in the webbrowser using the code by Petr in his recent response to martin.
1- open the file ActiveGLImpl1.pas in notepad the replace all the code between glBegin(.....); and glEnd; with the pyramid code:
or whatever you want.
2 - use an old version of Delphi 7 enterprise, install it temporary for the testing purposes only, and click file -> open project, then open the ActiveGLProject.dpr you will see in this file a line {$E ocx}, but if you want a dll change it to {$E dll} then save it.
3 - click in the menu Project -> Compile ActiveGLProject then Build ActiveGLProject. and you will see in the source code folder either an ActiveGLProject.ocx or ActiveGLProject.dll upon your choice.
4 - copy the ActiveGLProject.dll to the windows\system32 folder then register it, every time you want to test another ocx/dll you must unregister it like this :
regsvr32.exe -u ActiveGLProject.dll
then copy the new one and register it again.
i do not know the delphi language, this is just like walking during a sleep.
attached the thinbasic program (the same one by Petr: just it is opening the ActiveGL.htm instead of google.com , together with the slightly modified delphi source and the activex dll, register it before running the thinbasic program.
it is interesting to note that there is no security warning when running the activex ocx/dll from the webbrowser control. there are many many ideas and suggestions concerning displaying opengl in the webbrowser. one of them is to be able to supply the htm code within the thinbasic code instead of running the htm page. second is to make a generic activex dll which will accept the opengl code from the thinbasic code something like the oxygen approach or another possible approaches.
i forgot to say that in the thinbasic code :
WebBrowser_Navigate2(cbhndl, %ID_WEB1, "ActiveGL.htm")
i can't run the ActiveGL.htm file until i specify it's complete path, so to copy the file into c:\ then the code is:
WebBrowser_Navigate2(cbhndl, %ID_WEB1, "c:\ActiveGL.htm")
the second is working.
i do not know if this is a BUG or not, since it may be the webbrowser control designed to display http://www.... and not the local htm files.
here is what you should see:
http://img35.imageshack.us/img35/9669/pyramid2n.jpg
For other Delphi Fun codes ;maths,physics,puzzles...look here:
http://www.delphiforfun.org/programs/index.htm
free source code with executables, written by old version of Delphi