Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Ralph Kern schrieb: hi Andreas, I made some first improvements by removing the viewer-setupViewerAsEmbeddedInWindow() and instead leaving the OpenGL initialization to osgViewer::GraphicsWindowWin32(). This is a first step towards an easier Linux transition. You find attached the modified plugin.cpp/plugin.h By the way: can you change the License in plugin.cpp to the standard OSG Public License or at least LGPL? I am not in favor of GPL because it is quite strict against any commercial usage pattern. regards Ralph Thanks Ralph. I hereby formally entitle you to change the license, it was an error of mine. Regards, Andreas Andreas Goebel schrieb: Not yet. I took a look over the weekend on the part of porting to linux. It should be just some easy changes to the plugin code, but the mozilla developper pages are a bit puzzling with regard to plugin development. There are many developpers out there making FF extensions, but only some dealing with plugins, besides the big ones (Flash/PDF/...) It seems that the includes used by Andreas to produce the win32 part are not the ones currently used for FF linux dev. So it might take some more effort to dig in the headers. I guess I might have some time in January to dig deeper in this subject. For javascript support there would be some more extensions needed to the plugin. It also truly needs some keyboard interface for switching manipulators I'd propose Andreas should just publish its current efforts to the community, and the community can do the necessary enhancements. regards Ralph ___ Hi, due to the illness of my son I don´t know if I will be able to do integration work before christmas. So please find attached the current source with Visual C++ project file of the plugin. I worked with the given basic windows-example. It occured to me that the api for plugins seems to have changed, but still supports the old api. So either documentation, examples or both are in a bad state. I would be very pleased if someone would port this to other platforms / browsers or enhance it. Personally I only need a very simple plugin, so I won´t improve it further at the moment. Note that it must be packed together with the 3rd party deps into an xpi file, with plugins and plugin-dll in the same folder as the msvcrt and manifest (see my xpi as reference). Regards, Andreas ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Does it also work with os/x linux and also javascript supported ? /adrian 2008/12/13 Andreas Goebel a-goe...@gmx.de Hi, as the plugin started to work after using SetDllDir, this made me confident that I could package it not to require the additional download of the MSRedist. I have now done so, and on my test-machine withoug redist, it works. So could you please uninstall the plugin, download again from raumgeometrie.de/testplugin/osgviewer.xpi, and test it with raumgeometrie.de/testplugin/gallery.html In case you downloaded the redist first, please uninstall it (unless you need it for something else). The background - if others encounter this problem: When you start a program (!), the dir the program lies in is automatically added to the dll-search-path. When you load a dll during runtime from another program, the dl-dir is not automatically added to the dll-search-path. By adding the toolkit-dir to the osgFilePath, the plugins were found, but the plugins themselves didn´t find their dependencies. Thus, if you pack your osg-program into a dll, you will probably always have to use the SetDllDir windows command, or set your path. or install the dlls in a system-directory. I think mine is the cleanest solution, as one does not have to pollute system-dirs with dlls, and use exactly the dlls needed for the program. Regards, Andreas P.S.: You can, of course, use this plugin to display all file-formats that osg supports. For this, the other plugins would have to be packed into the xpi, too. If one needs this, just put the plugins there, or mail me, if you don´t have this compiled with msvc 8.0 sp1) PPS: This plugin has been downloaded 343 times so far. As I will Open-Source it and give it away for free, it would be really nice if you reported if it works. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Adrian Egli ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Hi Adrian, It's windows only right now. I haven' used it as I'm using Linux but I doubt that it does support javascript as this would require some kind of publishing of interface to the viewer which I didn't spot on review of the code. Robert. On Mon, Dec 15, 2008 at 8:35 AM, Adrian Egli OpenSceneGraph (3D) 3dh...@gmail.com wrote: Does it also work with os/x linux and also javascript supported ? /adrian 2008/12/13 Andreas Goebel a-goe...@gmx.de Hi, as the plugin started to work after using SetDllDir, this made me confident that I could package it not to require the additional download of the MSRedist. I have now done so, and on my test-machine withoug redist, it works. So could you please uninstall the plugin, download again from raumgeometrie.de/testplugin/osgviewer.xpi, and test it with raumgeometrie.de/testplugin/gallery.html In case you downloaded the redist first, please uninstall it (unless you need it for something else). The background - if others encounter this problem: When you start a program (!), the dir the program lies in is automatically added to the dll-search-path. When you load a dll during runtime from another program, the dl-dir is not automatically added to the dll-search-path. By adding the toolkit-dir to the osgFilePath, the plugins were found, but the plugins themselves didn´t find their dependencies. Thus, if you pack your osg-program into a dll, you will probably always have to use the SetDllDir windows command, or set your path. or install the dlls in a system-directory. I think mine is the cleanest solution, as one does not have to pollute system-dirs with dlls, and use exactly the dlls needed for the program. Regards, Andreas P.S.: You can, of course, use this plugin to display all file-formats that osg supports. For this, the other plugins would have to be packed into the xpi, too. If one needs this, just put the plugins there, or mail me, if you don´t have this compiled with msvc 8.0 sp1) PPS: This plugin has been downloaded 343 times so far. As I will Open-Source it and give it away for free, it would be really nice if you reported if it works. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Adrian Egli ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Robert Osfield schrieb: Hi Adrian, It's windows only right now. I haven' used it as I'm using Linux but I doubt that it does support javascript as this would require some kind of publishing of interface to the viewer which I didn't spot on review of the code. Robert. Right. As my son is ill right now and cannot go to the kindergarten, I cannot really work at the moment. I´ll integrate the plugin with cmake within this week, and then interested people can add linux support and scripting. There is an example on how to do the scripting in the firefox source-tree. Regards, Andreas ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Adrian Egli OpenSceneGraph (3D) schrieb: Does it also work with os/x linux and also javascript supported ? /adrian Not yet. I took a look over the weekend on the part of porting to linux. It should be just some easy changes to the plugin code, but the mozilla developper pages are a bit puzzling with regard to plugin development. There are many developpers out there making FF extensions, but only some dealing with plugins, besides the big ones (Flash/PDF/...) It seems that the includes used by Andreas to produce the win32 part are not the ones currently used for FF linux dev. So it might take some more effort to dig in the headers. I guess I might have some time in January to dig deeper in this subject. For javascript support there would be some more extensions needed to the plugin. It also truly needs some keyboard interface for switching manipulators I'd propose Andreas should just publish its current efforts to the community, and the community can do the necessary enhancements. regards Ralph ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Hi, as the plugin started to work after using SetDllDir, this made me confident that I could package it not to require the additional download of the MSRedist. I have now done so, and on my test-machine withoug redist, it works. So could you please uninstall the plugin, download again from raumgeometrie.de/testplugin/osgviewer.xpi, and test it with raumgeometrie.de/testplugin/gallery.html In case you downloaded the redist first, please uninstall it (unless you need it for something else). The background - if others encounter this problem: When you start a program (!), the dir the program lies in is automatically added to the dll-search-path. When you load a dll during runtime from another program, the dl-dir is not automatically added to the dll-search-path. By adding the toolkit-dir to the osgFilePath, the plugins were found, but the plugins themselves didn´t find their dependencies. Thus, if you pack your osg-program into a dll, you will probably always have to use the SetDllDir windows command, or set your path. or install the dlls in a system-directory. I think mine is the cleanest solution, as one does not have to pollute system-dirs with dlls, and use exactly the dlls needed for the program. Regards, Andreas P.S.: You can, of course, use this plugin to display all file-formats that osg supports. For this, the other plugins would have to be packed into the xpi, too. If one needs this, just put the plugins there, or mail me, if you don´t have this compiled with msvc 8.0 sp1) PPS: This plugin has been downloaded 343 times so far. As I will Open-Source it and give it away for free, it would be really nice if you reported if it works. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Hi Andreas, Sorry for answering so late. I you use private side-by-side assemblies, I think you should create a subdir named Microsoft.VC80.CRT containing: - Microsoft.VC80.CRT.manifest - msvcm80.dll - msvcp80.dll - msvcr80.dll Be aware that if you use MFC or ATL, then you'll have to also include dirs like Microsoft.VC80.MFC (or something like that). Else, you can create an installer that will install the MSVC redistribuables... Sukender PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/ Hi Sukender, interesting doc. I have supplied the redistributables, but in the same directory, not in a subdir. Does this make a difference? And: x86/Microsoft.VC80.CRT you specify that directory. Does this mean it has to be a subdir x86 with another subdir Microsoft.VC80.CRT, and that containing the dlls and the manifests of the redist, or should the manifests be in the same directory as the program, and the rest in the subdir? Note that in my case the thing is very complicated: - the program works on my machine - on another machine libcurl fails to load. When using debug-level warings one sees, that it is found in the right location, but fails to load. Unfortunately it doesn´t tell why it fails. It even fails when I put everything in my path. If I construct a testcase where libcurl is not needed, everything works. If I construct a testcase where I use osgviewer to load using libcurl, everything works too. It would not work at all if the redist was not found. This is on manifest-hell of a problem. I am not even sure if it is a manifest-problem, it might be something completely different. Regards, Andreas ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Forgot to mention: - Check if the cURL plugin use some other side-by-side assemblies (such as VC8 non-SP1 for instance). Maybe you'll need to recompile it? - Also check on Vista if you can, because Vista simply pops-up an error (cannot load the executable) when correct side-by-side assemblies are not found (but I guess not for delay-loaded DLLs...?). - And finaly, try your plugin on a clean machine with no MSVC installed, and no redistribuables installed, if possible. And to be more precise: private side-by-side assemblies can sometimes NOT coexist (VC8 non-SP1 / VC8 SP1 for instance) since they would be in the same dir with the same name. However, they ensure your plugin will work even with no redistribuables installed, at the cost of some kB in the plugin installer. Hope you'll find how to make it work. Sukender PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/ Le Tue, 09 Dec 2008 11:52:52 +0100, Sukender [EMAIL PROTECTED] a écrit: Hi Andreas, Sorry for answering so late. I you use private side-by-side assemblies, I think you should create a subdir named Microsoft.VC80.CRT containing: - Microsoft.VC80.CRT.manifest - msvcm80.dll - msvcp80.dll - msvcr80.dll Be aware that if you use MFC or ATL, then you'll have to also include dirs like Microsoft.VC80.MFC (or something like that). Else, you can create an installer that will install the MSVC redistribuables... Sukender PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/ Hi Sukender, interesting doc. I have supplied the redistributables, but in the same directory, not in a subdir. Does this make a difference? And: x86/Microsoft.VC80.CRT you specify that directory. Does this mean it has to be a subdir x86 with another subdir Microsoft.VC80.CRT, and that containing the dlls and the manifests of the redist, or should the manifests be in the same directory as the program, and the rest in the subdir? Note that in my case the thing is very complicated: - the program works on my machine - on another machine libcurl fails to load. When using debug-level warings one sees, that it is found in the right location, but fails to load. Unfortunately it doesn´t tell why it fails. It even fails when I put everything in my path. If I construct a testcase where libcurl is not needed, everything works. If I construct a testcase where I use osgviewer to load using libcurl, everything works too. It would not work at all if the redist was not found. This is on manifest-hell of a problem. I am not even sure if it is a manifest-problem, it might be something completely different. Regards, Andreas ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Jean-Sébastien Guay schrieb: Hi Andreas, Its so strange that the other plugins find the redist, but the curl plugin doesn't. I think the distinction is that the other plugins are only C libraries, whereas curl has C++ code. The redist is for C++. And I've seen the problem of plugins being found but then failing to load, and it was always caused by dependencies not being found at load time. So you just need to figure out where to place them for them to be found. I think you're on the right path. Hope this helps, J-S Thanks for cheering me up! ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Hi Andreas, I strongly suggest you to use (well, keep) SP1 since dependencies use it, and as it seems to be no reason keeping non-SP1. Your problem is maybe about how side-by-side assemblies are used under Windows (XP, Vista...). You may document yourself on that subject. You roughly have to know that before Win2000, Windows tries to load DLLs looking in the PATH. But after 2000, DLLs can also be located in special directories, so that different versions of the same DLL can coexist (See my project doc below). If you have problems with MSVC *runtimes*, have a look to: - http://msdn.microsoft.com/en-us/library/ms235299(VS.80).aspx - http://msdn.microsoft.com/en-us/library/ms235291(VS.80).aspx - And my project doc (I already posted this link but maybe this gonna be useful): http://pvle.svn.sourceforge.net/viewvc/pvle/trunk/Doc/Guides/Deploying%20a%20VisualC%2B%2B%20application.txt?view=markup . It's about how I need to do things for my engine under Windows. I personnaly chose to copy runtimes in a Microsoft.VC80.CRT subdir. You can also try to install redistribuables for VC8 SP1. Hope it helps. Sukender PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/ Le Sun, 07 Dec 2008 00:31:23 +0100, Andreas Goebel [EMAIL PROTECTED] a écrit: Hi all, now I´ve installed Service Pack 1 for MSVC, rebuilt all, and still on the other system the plugin fails to work. I use MSys to get a console, and catch debug-messages, and it simply states DynamicLibrary: Failed loading ...curl.dll. I have checked all dependencies with Dependency Walker, everything is in place. How can this be? Regards, Andreas ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Sukender schrieb: Hi Andreas, I strongly suggest you to use (well, "keep") SP1 since dependencies use it, and as it seems to be no reason keeping non-SP1. Your problem is maybe about how "side-by-side" assemblies are used under Windows (XP, Vista...). You may document yourself on that subject. You roughly have to know that before Win2000, Windows tries to load DLLs looking in the PATH. But after 2000, DLLs can also be located in special directories, so that different versions of the same DLL can coexist (See my project doc below). If you have problems with MSVC *runtimes*, have a look to: - http://msdn.microsoft.com/en-us/library/ms235299(VS.80).aspx - http://msdn.microsoft.com/en-us/library/ms235291(VS.80).aspx - And my project doc (I already posted this link but maybe this gonna be useful): http://pvle.svn.sourceforge.net/viewvc/pvle/trunk/Doc/Guides/Deploying%20a%20VisualC%2B%2B%20application.txt?view=markup . It's about how I need to do things for my engine under Windows. I personnaly chose to copy runtimes in a "Microsoft.VC80.CRT" subdir. You can also try to install redistribuables for VC8 SP1. Hope it helps. Sukender PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/ Le Sun, 07 Dec 2008 00:31:23 +0100, Andreas Goebel [EMAIL PROTECTED] a écrit: Hi Sukender, interesting doc. I have supplied the redistributables, but in the same directory, not in a subdir. Does this make a difference? And: "x86/Microsoft.VC80.CRT" you specify that directory. Does this mean it has to be a subdir "x86" with another subdir "Microsoft.VC80.CRT", and that containing the dlls and the manifests of the redist, or should the manifests be in the same directory as the program, and the rest in the subdir? Note that in my case the thing is very complicated: - the program works on my machine - on another machine libcurl fails to load. When using debug-level warings one sees, that it is found in the right location, but fails to load. Unfortunately it doesn´t tell why it fails. It even fails when I put everything in my path. If I construct a testcase where libcurl is not needed, everything works. If I construct a testcase where I use osgviewer to load using libcurl, everything works too. It would not work at all if the redist was not found. This is on manifest-hell of a problem. I am not even sure if it is a manifest-problem, it might be something completely different. Regards, Andreas Hi all, now I´ve installed Service Pack 1 for MSVC, rebuilt all, and still on the other system the plugin fails to work. I use MSys to get a console, and catch debug-messages, and it simply states DynamicLibrary: Failed loading ...curl.dll. I have checked all dependencies with Dependency Walker, everything is in place. How can this be? Regards, Andreas ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Hi again, I ´ve downloaded the redist for SP1. Now it works on the other machine, too. Problem: How could I package this that the curl-plugin does find the assemblys? If I don´t manage this, I'll have users to download the redist-package. Its so strange that the other plugins find the redist, but the curl plugin doesn't. Regards, Andreas ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Hi, on my non-dev system the curl-plugin doesn´t load. Any ideas why this could be? ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Hi all, now I´ve installed Service Pack 1 for MSVC, rebuilt all, and still on the other system the plugin fails to work. I use MSys to get a console, and catch debug-messages, and it simply states DynamicLibrary: Failed loading ...curl.dll. I have checked all dependencies with Dependency Walker, everything is in place. How can this be? Regards, Andreas ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
HI Andreas, Nice to see the plugin work coming along. The setUpViewerAsEmbeddedInWindow calls tricks the viewer into thinking that it has a valid graphics context, but in reality the GraphicsWindowEmbedded that this call creates is just a non op for all makeCurrent/swapBuffer calls, which means the viewer itself can't do these operations. This scheme only works when you have one context per viewer and run the viewer single threaded, and the app that calls viewer.frame() creates it's own graphics context and makes it current, and does the swap buffers call itself. The Embedded functionality of osgViewer does make it extremely easy to graft an viewer into an code that provides the graphics context, but it is limiting - you won't be pbuffer support, or any multi-window/context support, nor threading support, but for a browser this possible isn't to much of an issue as you aren't likely to be drive a full blow simulation from a browser. To get get the full capabilities of osgViewer then using the window inheritance features of osgViewer would be the way forward - here you'd like the browser provide the parent widget that osgViewer will create it's own OpenGL GraphicsContext within. This is typically more awkward to code as you have to go get the native window handle, but if this is possible then you should be able to code up a solution similar to the osgviewerMFC example. Robert. On Thu, Dec 4, 2008 at 8:32 PM, Andreas Goebel [EMAIL PROTECTED] wrote: Hi all, as posted above in the thread reading a node file from http, I have assembled a small firefox-plugin to display osg-files. It is not yet packed, I will have to carefully read the documentation on how to do this (I would like the plugin to be downloaded automatically when a user does not have it). If someone would like to try it: - it´s windows only, firefox 3.04 only (newer versions should work) - you must have osg2.7.6 installed, bin-dir in your path. The plugin is compiled with VC 2005, so maybe only this will work - download the plugin here: http://raumgeometrie.de/testplugin/npbasic.dll (it´s so small, not even worth zipping) - testpages here: http://www.raumgeometrie.de/testplugin/gallery.html I attach the source to the plugin. But be aware of the fact, that the most time-consuming step of building this plugin was to get the basic-example I started with to compile. I will send a zip with project-file later on. Note that the sample-plugins shipped with the firefox-source do use completely different function-names than those described in the plugin-api that can be read on the firefox-dev site. I sticked to the functions named in the sample (and had to research with google for some things). I don´t know if their own samples are outdated, or if the api-documentation is outdated or whatever. The thing that does not (!) work is to put several instances of the plugin on one page. Maybe robert can jump in and explain how the window = viewer-setUpViewerAsEmbeddedInWindow(100,100,800,600); viewer-setSceneData(loadedModel.get()); (which works like next to magic for me) does find it´s OpenGL-context. Probably this is not so easy when there is more than one context. But even if this won´t work, it´s quite a nice plugin so far. Read the source as an inspiration on how very easy this was - hopefully someone can jump in and do this for linux and mac. Regards, Andreas ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Hi, I am busy packing the plugin. My question: I´d like to keep in lean and mean. So I´d like to know to which osg-libs it is essential to link to be able to load simple osg-files with textures and no effects. Regards, Andreas ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Hi Andreas, I had a quick review of the plugin.cpp you posted and it's tiny, which is definitely a good thing ;-) I see that code you are using is being passed in a native window handle so there is probably a reasonable chance that we could just use this with and have the osgViewer create the graphics context using the window inheritance feature. This might be a way of make the code more portable across platforms as well as it would reduce the amount of platform specific code. This is a bridge that could be crossed later though. In the review of the code I spotted that the plugin.h was referenced, but you didn't include the plugin.h. Could you post this. Without the header I can't say for sure, but my guess is that the OSG related global variables could be moved into the nsPluginInstance class that you've created. Do you have particular web documentation you've been using for inspiration? Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Robert Osfield schrieb: HI Andreas, Nice to see the plugin work coming along. The setUpViewerAsEmbeddedInWindow calls tricks the viewer into thinking that it has a valid graphics context, but in reality the GraphicsWindowEmbedded that this call creates is just a non op for all makeCurrent/swapBuffer calls, which means the viewer itself can't do these operations. This scheme only works when you have one context per viewer and run the viewer single threaded, and the app that calls viewer.frame() creates it's own graphics context and makes it current, and does the swap buffers call itself. The Embedded functionality of osgViewer does make it extremely easy to graft an viewer into an code that provides the graphics context, but it is limiting - you won't be pbuffer support, or any multi-window/context support, nor threading support, but for a browser this possible isn't to much of an issue as you aren't likely to be drive a full blow simulation from a browser. To get get the full capabilities of osgViewer then using the window inheritance features of osgViewer would be the way forward - here you'd like the browser provide the parent widget that osgViewer will create it's own OpenGL GraphicsContext within. This is typically more awkward to code as you have to go get the native window handle, but if this is possible then you should be able to code up a solution similar to the osgviewerMFC example. Robert. Hi Robert, in my opinion those web-plugins should function as a teaser making people think: That looks cool, lets try the application. Thus the embedded-functionality will be enough for me. I am now packaging the plugin and encounter a problem: The plugin starts (meaning that the core osg-dlls are found), but it does not find the osg-plugins (I have removed osg from my path for testing reasons). Usually when you start an osg-application and put the plugins into the applicaiton-folder (or below into the correct plugin-folder) they are found. Maybe this is different here, as the plugin itself is not an application but a dll. Any idea how I could trick the osg to make it find the plugins? The problem is that I can run the plugin in firefox only, it´s hard to debug there. Regards, Andreas On Thu, Dec 4, 2008 at 8:32 PM, Andreas Goebel [EMAIL PROTECTED] wrote: Hi all, as posted above in the thread reading a node file from http, I have assembled a small firefox-plugin to display osg-files. It is not yet packed, I will have to carefully read the documentation on how to do this (I would like the plugin to be downloaded automatically when a user does not have it). If someone would like to try it: - it´s windows only, firefox 3.04 only (newer versions should work) - you must have osg2.7.6 installed, bin-dir in your path. The plugin is compiled with VC 2005, so maybe only this will work - download the plugin here: http://raumgeometrie.de/testplugin/npbasic.dll (it´s so small, not even worth zipping) - testpages here: http://www.raumgeometrie.de/testplugin/gallery.html I attach the source to the plugin. But be aware of the fact, that the most time-consuming step of building this plugin was to get the basic-example I started with to compile. I will send a zip with project-file later on. Note that the sample-plugins shipped with the firefox-source do use completely different function-names than those described in the plugin-api that can be read on the firefox-dev site. I sticked to the functions named in the sample (and had to research with google for some things). I don´t know if their own samples are outdated, or if the api-documentation is outdated or whatever. The thing that does not (!) work is to put several instances of the plugin on one page. Maybe robert can jump in and explain how the window = viewer-setUpViewerAsEmbeddedInWindow(100,100,800,600); viewer-setSceneData(loadedModel.get()); (which works like next to magic for me) does find it´s OpenGL-context. Probably this is not so easy when there is more than one context. But even if this won´t work, it´s quite a nice plugin so far. Read the source as an inspiration on how very easy this was - hopefully someone can jump in and do this for linux and mac. Regards, Andreas ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Robert Osfield schrieb: Hi Andreas, I had a quick review of the plugin.cpp you posted and it's tiny, which is definitely a good thing ;-) I see that code you are using is being passed in a native window handle so there is probably a reasonable chance that we could just use this with and have the osgViewer create the graphics context using the window inheritance feature. This might be a way of make the code more portable across platforms as well as it would reduce the amount of platform specific code. This is a bridge that could be crossed later though. In the review of the code I spotted that the plugin.h was referenced, but you didn't include the plugin.h. Could you post this. Without the header I can't say for sure, but my guess is that the OSG related global variables could be moved into the nsPluginInstance class that you've created. Do you have particular web documentation you've been using for inspiration? Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org Find the attached files. I have already refactored this not to use global variables. The sources I used are here: http://www.codeproject.com/KB/openGL/FirefoxOpenGL.aspx and the osgglut-example. Regards, Andreas /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * BEGIN LICENSE BLOCK * * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the License); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an AS IS basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the GPL), or * the GNU Lesser General Public License Version 2.1 or later (the LGPL), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * * END LICENSE BLOCK * */ #ifndef __PLUGIN_H__ #define __PLUGIN_H__ #include pluginbase.h #include osgViewer/Viewer #include osgViewer/ViewerEventHandlers #include osgGA/TrackballManipulator #include osgDB/ReadFile #include windows.h #include windowsx.h class nsPluginInstance : public nsPluginInstanceBase { public: nsPluginInstance(NPP aInstance); ~nsPluginInstance(); NPBool init(NPWindow* aWindow); void shut(); NPBool isInitialized(); // locals const char * getVersion(); void mousebutton( int button, int state, int x, int y ); void mousemove( int x, int y ); char* filename; int width; int height; HDC hDC; HGLRC hRC; osg::ref_ptrosgViewer::Viewer viewer; private: NPP mInstance; NPBool mInitialized; HWND mhWnd; osg::observer_ptrosgViewer::GraphicsWindow window; }; #endif // __PLUGIN_H__ /*OpenSceneGraph Firefox-plugin *License: GPL 2.0 *Based on Work by Mozilla.org and OpenSceneGraph osgviewerGLUT-sample by Robert Osfield *(c) Andreas Goebel 2008 */ #include plugin.h #include gl/gl.h #include stdlib.h /* //Global Variables osg::ref_ptrosgViewer::Viewer viewer; osg::observer_ptrosgViewer::GraphicsWindow window; char* filename; */ //Functions that translate the Windows Mouse-Events to osg-events void nsPluginInstance::mousebutton( int button, int state, int x, int y ) { if (window.valid()) { if (state==0) window-getEventQueue()-mouseButtonPress( x, y, button+1 ); else window-getEventQueue()-mouseButtonRelease( x, y, button+1 ); } } void nsPluginInstance::mousemove( int x, int y ) { if (window.valid()) { window-getEventQueue()-mouseMotion( x, y ); } } // // // general initialization and shutdown // NPError NS_PluginInitialize() { return NPERR_NO_ERROR; } void
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Hi Andeas, On Fri, Dec 5, 2008 at 10:05 AM, Andreas Goebel [EMAIL PROTECTED] wrote: in my opinion those web-plugins should function as a teaser making people think: That looks cool, lets try the application. Thus the embedded-functionality will be enough for me. It'll be interesting to see where things might go. I've been thinking about putting Prestent3D in a browser for a long time, but never had the time and knowledge about writing it to tackle it. No doubt lots of others have been on the brink of diving into this area too. I'm curious about the possibility of writing OSG viewer code in a way that could be used either in an traditional application or a plugin to other apps like a browser. This is not something to worry about though, I'll just let this stuff idle away at the back of mind until something useful pops out. I am now packaging the plugin and encounter a problem: The plugin starts (meaning that the core osg-dlls are found), but it does not find the osg-plugins (I have removed osg from my path for testing reasons). Usually when you start an osg-application and put the plugins into the applicaiton-folder (or below into the correct plugin-folder) they are found. Maybe this is different here, as the plugin itself is not an application but a dll. You will probably have to explicitly provide the library path to go searching for the plugins. You could either call use the OSG_LIBRARY_PATH env var or set the search path manually via: osgDB::setLibraryFilePathList(mypath) Or prepend the path to the plugins via: osgDB::getLibraryFilePathList().push_front(mypath); Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Andreas Goebel schrieb: Any idea how I could trick the osg to make it find the plugins? The problem is that I can run the plugin in firefox only, it´s hard to debug there. a simple trick, when I have to debug embedded dll's, is: - use _CrtDbgBreak() in your startup code. It'll pop up the Just-In-Time-Debugger dialog, which allows you to start the Visual Studio Debugger at that point - or put a MessageBox(NULL, , MB_OK) in the startup code. Use Debug Attach to process in your Visual Studio and set a breakpoint to the line after the MessageBox call. Click OK on the MessageBox and you should be right there in the Debugger. I don't know whether these will work with VS Express, but at least with VS Standard Edition and higher. I hope you'll get forward with your plugin. Can you also post the download place for the firefox plugin SDK? I hope to find some time to expand your work in the longer run. regards Ralph ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
You will probably have to explicitly provide the library path to go searching for the plugins. You could either call use the OSG_LIBRARY_PATH env var or set the search path manually via: osgDB::setLibraryFilePathList(mypath) Or prepend the path to the plugins via: osgDB::getLibraryFilePathList().push_front(mypath); I´d sure like to do this, but I can´t figure out the path. I don´t know beforehand where Firefox will install the plugin, the path might be different on all machines. I tried various functions, but all only return me the path to the firefox-executable, not the plugin-dll. I consider building a setup with inno-setup, where I can extend PATH. Any windows-gurus or firefox-gurus that have an idea how I could get the path to the plugin? Regards, Andreas Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Andreas Goebel schrieb: You will probably have to explicitly provide the library path to go searching for the plugins. You could either call use the OSG_LIBRARY_PATH env var or set the search path manually via: osgDB::setLibraryFilePathList(mypath) Or prepend the path to the plugins via: osgDB::getLibraryFilePathList().push_front(mypath); I´d sure like to do this, but I can´t figure out the path. I don´t know beforehand where Firefox will install the plugin, the path might be different on all machines. I tried various functions, but all only return me the path to the firefox-executable, not the plugin-dll. I consider building a setup with inno-setup, where I can extend PATH. Any windows-gurus or firefox-gurus that have an idea how I could get the path to the plugin? Regards, Andreas Or can I force osg to load the plugins on startup? I remember something about fake .lib-files for the plugins, is that right? How can I build them? Regards, Andreas Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
On windows you can call GetModuleFileName which retrieves the fully qualified path to the dll/exe in which the calling function resides. 2008/12/5 Andreas Goebel [EMAIL PROTECTED]: You will probably have to explicitly provide the library path to go searching for the plugins. You could either call use the OSG_LIBRARY_PATH env var or set the search path manually via: osgDB::setLibraryFilePathList(mypath) Or prepend the path to the plugins via: osgDB::getLibraryFilePathList().push_front(mypath); I´d sure like to do this, but I can´t figure out the path. I don´t know beforehand where Firefox will install the plugin, the path might be different on all machines. I tried various functions, but all only return me the path to the firefox-executable, not the plugin-dll. I consider building a setup with inno-setup, where I can extend PATH. Any windows-gurus or firefox-gurus that have an idea how I could get the path to the plugin? Regards, Andreas Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- The truth is out there. Usually in header files. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Simon Hammett schrieb: On windows you can call GetModuleFileName which retrieves the fully qualified path to the dll/exe in which the calling function resides. Sadly no, it returns the path to firefox.exe, already tried that. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
2008/12/5 Andreas Goebel [EMAIL PROTECTED]: Simon Hammett schrieb: On windows you can call GetModuleFileName which retrieves the fully qualified path to the dll/exe in which the calling function resides. Sadly no, it returns the path to firefox.exe, already tried that. The only way I can think of that GetModuleFileName would fail is if people start moving code around in memory. Seems unlikely firefox would do that. Try EnumProcessModules then to get the module handle to your dll. Then you can use GetModuleFileName with the correct handle. -- The truth is out there. Usually in header files. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Simon Hammett schrieb: 2008/12/5 Andreas Goebel [EMAIL PROTECTED]: Simon Hammett schrieb: On windows you can call GetModuleFileName which retrieves the fully qualified path to the dll/exe in which the calling function resides. Sadly no, it returns the path to firefox.exe, already tried that. The only way I can think of that GetModuleFileName would fail is if people start moving code around in memory. Seems unlikely firefox would do that. Try EnumProcessModules then to get the module handle to your dll. Then you can use GetModuleFileName with the correct handle. I´ll have to stop working on that till tonight. Maybe you could give me a code-snippet, I am no expert-windows-api-programmer, I prefer using wxWidgets. Regards, Andreas ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
2008/12/5 Andreas Goebel [EMAIL PROTECTED]: Simon Hammett schrieb: 2008/12/5 Andreas Goebel [EMAIL PROTECTED]: Simon Hammett schrieb: On windows you can call GetModuleFileName which retrieves the fully qualified path to the dll/exe in which the calling function resides. Sadly no, it returns the path to firefox.exe, already tried that. The only way I can think of that GetModuleFileName would fail is if people start moving code around in memory. Seems unlikely firefox would do that. Try EnumProcessModules then to get the module handle to your dll. Then you can use GetModuleFileName with the correct handle. I´ll have to stop working on that till tonight. Maybe you could give me a code-snippet, I am no expert-windows-api-programmer, I prefer using wxWidgets. http://msdn.microsoft.com/en-us/library/ms682631(VS.85).aspx That's the doc for the function and there is example code linked to as well. If you ever need info for windows programming, always check out msdn. Not a big fan of MS, but their documentation is usually pretty good; once you can work out what they've called the feature you are interested in is called anyway. -- The truth is out there. Usually in header files. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Andreas Goebel schrieb: Simon Hammett schrieb: On windows you can call GetModuleFileName which retrieves the fully qualified path to the dll/exe in which the calling function resides. Sadly no, it returns the path to firefox.exe, already tried that. Did you look for the current directory? I'd guess the Plugin Manager sets it to the plugin dir. Otherwise if you can't get the DLL instance of your plugin to pass to GetModuleFileName(), you can try another trick: HINSTANCE handle =LoadLibrary( name of your plugin dll here ); if (handle) { GetModuleFileName(handle, filename, sizeof(filename)); PathRemoveFileSpec(filename); FreeLibrary(handle); } This should work because the list of loaded DLLs is searched first by LoadLibrary(). regards Ralph ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Simon Hammett schrieb: The only way I can think of that GetModuleFileName would fail is if people start moving code around in memory. Seems unlikely firefox would do that. It does not fail, but his plugin source code does not know it's instance handle, because DllMain() is deeply buried in the Plugin API, I guess. See my other post on this thread with a relatively simple workaround using LoadLibrary() a second time on the plugin DLL with a local path. regards Ralph ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Andreas Goebel ha scritto: Try this: #ifdef XP_WIN char buf[MAX_PATH]; if ( ::GetModuleFileName(::GetModuleHandle(npOSG4Web.dll), buf, sizeof(buf)) ) { char* lastSlash = strrchr(buf, '\\'); if (lastSlash) *(lastSlash + 1) = '\0'; mShellBase.setInitOption(INIT_OPTION_INSTALLDIR, std::string(buf)); This is tied to my npOSG4Web.dll , you have to substitute your dll Are you trying to deploy as a Firefox extension? I' ve managed to build, but did not already inserted in the CMake project. I like that way of deployment, it gives you also an update mechanism with signing features You could easily grab the stuff if you just install my plugin into a new folder like D:\Programmi\Mozilla Firefox\firefox.exe -no-remote --profile D:/Temp/prova1 http://3d.cineca.it/storage/models/gaiani/htdocs/index.html your firefox -no-remote --profile a new folder http://3d.cineca.it/storage/models/gaiani/htdocs/index.html then look into a new folder[EMAIL PROTECTED] for the file install.rdf the important lines are updateKey and updateURL and em:id Simon Hammett schrieb: On windows you can call GetModuleFileName which retrieves the fully qualified path to the dll/exe in which the calling function resides. Sadly no, it returns the path to firefox.exe, already tried that. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Simon Hammett schrieb: If you pass a null handle to GetModuleFileName it uses the return address on the stack to work out which dll the calling function is in. It should always work for any function linked in an exe or dll. Sorry, Simon, you are wrong: Quote from MSDN GetModuleFileName(): http://msdn.microsoft.com/en-us/library/ms683199(VS.85).aspx If this parameter is NULL, GetModuleHandle returns a handle to the file used to create the calling process (.exe file). If you pass NULL, it refers to the .exe (firefox.exe), not to the DLL on the stack. regards Ralph ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
2008/12/5 Ralph Kern [EMAIL PROTECTED]: Simon Hammett schrieb: If you pass a null handle to GetModuleFileName it uses the return address on the stack to work out which dll the calling function is in. It should always work for any function linked in an exe or dll. Sorry, Simon, you are wrong: Quote from MSDN GetModuleFileName(): http://msdn.microsoft.com/en-us/library/ms683199(VS.85).aspx If this parameter is NULL, GetModuleHandle returns a handle to the file used to create the calling process (.exe file). If you pass NULL, it refers to the .exe (firefox.exe), not to the DLL on the stack. regards Ralph Nuts, I must be confusing it with one of the debug help functions. Easiest way is to do it DllMain then, you get passed the handle to your dll. Then just store the handle or the path. -- The truth is out there. Usually in header files. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Nuts, I must be confusing it with one of the debug help functions. Easiest way is to do it DllMain then, you get passed the handle to your dll. Then just store the handle or the path. Knew there was a relatively straight forward way of doing it: wchar_t buff[256]; buff[0] = '\0'; HMODULE module; if( TRUE == GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, reinterpret_cast LPCWSTR (DllMain), module) ) GetModuleFileName(module, buff, 256); You need _WIN32_WINNT as 0x0501 or later though -- The truth is out there. Usually in header files. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Did you look for the current directory? I'd guess the Plugin Manager sets it to the plugin dir. No. Otherwise if you can't get the DLL instance of your plugin to pass to GetModuleFileName(), you can try another trick: HINSTANCE handle =LoadLibrary( name of your plugin dll here ); if (handle) { GetModuleFileName(handle, filename, sizeof(filename)); PathRemoveFileSpec(filename); FreeLibrary(handle); } This should work because the list of loaded DLLs is searched first by LoadLibrary(). This works! Only one should not free the handle, as the lib is (probably) not loaded again, this gives a crash. I have then used Luigis way of extracting the path, as I do not have the header to PathRemoveFileSpec. I´ll pack this in the late evening, seems to be working now. Thanks for your help, Andreas regards Ralph ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Andreas Goebel schrieb: Otherwise if you can't get the DLL instance of your plugin to pass to GetModuleFileName(), you can try another trick: HINSTANCE handle =LoadLibrary( name of your plugin dll here ); if (handle) { GetModuleFileName(handle, filename, sizeof(filename)); PathRemoveFileSpec(filename); FreeLibrary(handle); } This should work because the list of loaded DLLs is searched first by LoadLibrary(). This works! Only one should not free the handle, as the lib is (probably) not loaded again, this gives a crash. You should do FreeLibrary() because it's reference counted internally. see http://msdn.microsoft.com/en-us/library/ms683152(VS.85).aspx: The system maintains a per-process reference count for each loaded module. A module that was loaded at process initialization due to load-time dynamic linking has a reference count of one. The reference count for a module is incremented each time the module is loaded by a call to LoadLibrary. The reference count is also incremented by a call to LoadLibraryEx unless the module is being loaded for the first time and is being loaded as a data or image file. regards Ralph ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Hi all, I have now packed the plugin and the necessary osg-libs into an xpi-file. You can use http://raumgeometrie.de/testplugin/test.html to download the plugin and test it. Use the source-view of the html-page to see how it is embedded. Note the following problem: Even though I have provided the plugin-url in the embed-tag, the plugin does not download when clicking on the icon. The link below (Hier Plugin, means plugin here) does work though. In the mozilla-docs it says that I have to register the mime-type with .htaccess, but either this doesn´t work or I made another mistake. Maybe someone can give insight on this. The plugin-package is lean and mean, meaning that it only works for osg and ive-files with no effects and jpg, gif or png-textures. For it to work with more filetypes I would have to pack all osg-plugins into the package. Please test it and report if it works. It would be great if someone could test on a machine that has no developer-tools installed, as dll-problems will occur here more likely than on a dev-machine that has all kinds o packages installed. Regards have fun, Andreas ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Hello Andreas, Nice work, it seems to work except the below: Note the following problem: Even though I have provided the plugin-url in the embed-tag, the plugin does not download when clicking on the icon. The link below (Hier Plugin, means plugin here) does work though. Yes, that's confusing, but with the link it works. I suspect it's just a small configuration issue, but I don't have any idea what that might be. Please test it and report if it works. How do you tell it to load a model? I get just the blue background. Again, good work, and I look forward to lots of cool browser apps in the future using this! J-S -- __ Jean-Sebastien Guay[EMAIL PROTECTED] http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Yes this is very cool. Similar to this canvas3d plugin (https://addons.mozilla.org/en-US/firefox/addon/7171) but with the power of osg... Very cool! -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jean-Sébastien Guay Sent: Friday, December 05, 2008 1:47 PM To: OpenSceneGraph Users Subject: Re: [osg-users] Very simple Firefox-Plugin to display osg-files Hello Andreas, Nice work, it seems to work except the below: Note the following problem: Even though I have provided the plugin-url in the embed-tag, the plugin does not download when clicking on the icon. The link below (Hier Plugin, means plugin here) does work though. Yes, that's confusing, but with the link it works. I suspect it's just a small configuration issue, but I don't have any idea what that might be. Please test it and report if it works. How do you tell it to load a model? I get just the blue background. Again, good work, and I look forward to lots of cool browser apps in the future using this! J-S -- __ Jean-Sebastien Guay[EMAIL PROTECTED] http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Jean-Sébastien Guay schrieb: Hello Andreas, Nice work, it seems to work except the below: Note the following problem: Even though I have provided the plugin-url in the embed-tag, the plugin does not download when clicking on the icon. The link below (Hier Plugin, means plugin here) does work though. Yes, that's confusing, but with the link it works. I suspect it's just a small configuration issue, but I don't have any idea what that might be. ... neither do I. I have tried a lot ... I will have to register at mozdev.org, I think, to ask about this. Please test it and report if it works. How do you tell it to load a model? I get just the blue background. That´s a mistake. Look at the page source, it should load a model. If it does not, it means that something is missing. Probably, as I fear, a dll that my system has and yours don´t. I´ll have to look into that. Regards, Andreas Again, good work, and I look forward to lots of cool browser apps in the future using this! J-S ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
I am seeing the same behavior as well. Just an empty osgviewer embedded in my browser. On 12/5/08 2:00 PM, Andreas Goebel [EMAIL PROTECTED] wrote: Jean-Sébastien Guay schrieb: Hello Andreas, Nice work, it seems to work except the below: Note the following problem: Even though I have provided the plugin-url in the embed-tag, the plugin does not download when clicking on the icon. The link below (Hier Plugin, means plugin here) does work though. Yes, that's confusing, but with the link it works. I suspect it's just a small configuration issue, but I don't have any idea what that might be. ... neither do I. I have tried a lot ... I will have to register at mozdev.org, I think, to ask about this. Please test it and report if it works. How do you tell it to load a model? I get just the blue background. That´s a mistake. Look at the page source, it should load a model. If it does not, it means that something is missing. Probably, as I fear, a dll that my system has and yours don´t. I´ll have to look into that. Regards, Andreas Again, good work, and I look forward to lots of cool browser apps in the future using this! J-S ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Hi Andreas, That´s a mistake. Look at the page source, it should load a model. If it does not, it means that something is missing. Probably, as I fear, a dll that my system has and yours don´t. I´ll have to look into that. Well, all I get are a few message boxes (I guess those are debugging messages :-) ) and then an empty osgviewer. Do the OSG error messages go to your webserver logs? Perhaps you could redirect osg::notify's streams to print them into the browser? Or a console in the OSG viewer... J-S -- __ Jean-Sebastien Guay[EMAIL PROTECTED] http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Jean-Sébastien Guay schrieb: Hi Andreas, That´s a mistake. Look at the page source, it should load a model. If it does not, it means that something is missing. Probably, as I fear, a dll that my system has and yours don´t. I´ll have to look into that. Well, all I get are a few message boxes (I guess those are debugging messages :-) ) and then an empty osgviewer. Do the OSG error messages go to your webserver logs? Perhaps you could redirect osg::notify's streams to print them into the browser? Or a console in the OSG viewer... J-S Hi, my mistake, sorry. I put the new plugin only to my local firefox, not into the xpi-archive. Please re-download in one minute (21:37 in my timezone). Regards, Andreas ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Hi all, I have now repackaged the xpi. I have turned my old laptop, that does not have dev-libraries, and tried it, and it didn´t work. On my dev-machine it works, even if I remove osg from my path. But: I have lots of libs in my path and in my windows-system. Please download the xpi from raumgeometrie.de/testplugin/test.html (link on bottom) and tell me if it works. If it doesn´t, please give hints what might be wrong. Regards, Andreas ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
That works completely. I installed it without any other installed and it works without error. On Fri, Dec 5, 2008 at 5:35 PM, Andreas Goebel [EMAIL PROTECTED] wrote: Hi all, I have now repackaged the xpi. I have turned my old laptop, that does not have dev-libraries, and tried it, and it didn´t work. On my dev-machine it works, even if I remove osg from my path. But: I have lots of libs in my path and in my windows-system. Please download the xpi from raumgeometrie.de/testplugin/test.html (link on bottom) and tell me if it works. If it doesn´t, please give hints what might be wrong. Regards, Andreas ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- It is only necessary to make war with five things: with the maladies of the body, with the ignorances of the mind, with the passions of the body, with the seditions of the city, with the discords of families. - Tacitus The desire for safety stands against every great and noble enterprise. - Tacitus Those who would give up essential liberty to purchase a little temporary safety deserve neither liberty nor safety. - Benjamin Franklin Numquam ponenda est pluralitas sine necessitate. - William of Ockham ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Hi, I have reviewed my own code and realized that, of course, the global variables were no good idea. I was not aware of the fact, that a plugin (the dll) is loaded only once, and each time the plugin is embedded, a new instance of the plugin-class is created. The global variables that live in the dll exist only once, thus it was not possible to display more than one model on a page. I have refactored this, now one can display several models on one page. There are some more issues, but I will work on that tomorrow. Regards, Andreas Screenshot: Two models on one page. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Very simple Firefox-Plugin to display osg-files
Thanks for your contributions! I'm really eager to see what projects will use this plugin of yours. It would be a great way of attracting new developers to OSG if they could check out demos online :) On Thu, Dec 4, 2008 at 4:08 PM, Andreas Goebel [EMAIL PROTECTED] wrote: Hi, I have reviewed my own code and realized that, of course, the global variables were no good idea. I was not aware of the fact, that a plugin (the dll) is loaded only once, and each time the plugin is embedded, a new instance of the plugin-class is created. The global variables that live in the dll exist only once, thus it was not possible to display more than one model on a page. I have refactored this, now one can display several models on one page. There are some more issues, but I will work on that tomorrow. Regards, Andreas Screenshot: Two models on one page. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org