Cruisers Forum
 

Go Back   Cruisers & Sailing Forums > Seamanship, Navigation & Boat Handling > OpenCPN
Cruiser Wiki Click Here to Login
Register Vendors FAQ Community Calendar Today's Posts Log in

Reply
  This discussion is proudly sponsored by:
Please support our sponsors and let them know you heard about their products on Cruisers Forums. Advertise Here
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 04-07-2012, 14:59   #1
Registered User
 
david.tischler's Avatar

Join Date: Apr 2010
Boat: Ebbtide 36
Posts: 6
Plugin with RenderOverlay in OpenCPN 3.0

Hi!

Some time ago, with OpenCPN 2.5, I started developing a plugin that draws an overlay. Now I rebuilt it with the latest source code for OpenCPN 3.0, and tested it with 3.0.0, and now 3.0.1.

It still works, but when running in OpenGL mode RenderOverlay doesn't get called. If I read the OpenCPN source code correctly, then also in OpenGL-mode the 'old'-style rendering should work.

So before I go into more detail, is this assumption correct, or do I have to duplicate the rendering for OpenGL?

David
david.tischler is offline   Reply With Quote
Old 04-07-2012, 15:38   #2
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,523
Re: Plugin with RenderOverlay in OpenCPN 3.0

David...

It should work at reduced performance. The plugin is asked to render to a memory DC, which is then drawn on the GL screen by ocpndcrawBitmap().

This code path was probably not well tested....

Does this not work for you? If not, we'll fix it.

Look in pluginmanager.cpp around line 529, and see if this makes sense.

Dave
bdbcat is offline   Reply With Quote
Old 04-07-2012, 15:56   #3
Registered User
 
david.tischler's Avatar

Join Date: Apr 2010
Boat: Ebbtide 36
Posts: 6
Re: Plugin with RenderOverlay in OpenCPN 3.0

Yes, the code in PlugInManager::RenderAllCanvasOverlayPlugIns was the reason why I assumed it should be working.

What I tried so far:
  • put a wxLogMessage as first line in my RenderOverlay-implementation - it gets called in non OpenGL-mode, but not in OpenGL-mode
  • changed the plugin API version, from 1.5 through to 1.8, including the change of the method signature for RenderOverlay - no change in behaviour

When I find time I will try to get my debugger working, maybe I can see why RenderOverlay doesn't get called.

David
david.tischler is offline   Reply With Quote
Old 04-07-2012, 16:09   #4
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,523
Re: Plugin with RenderOverlay in OpenCPN 3.0

David....

OK, we are on the same page here. I'll try to hack up a test case and step through it.
What API version are you using for your PlugIn?
And what exact flags are you returning from using for PlugIn::Init() method?

For example, GRIB plugin does

Code:
      return (WANTS_OVERLAY_CALLBACK |
           WANTS_OPENGL_OVERLAY_CALLBACK |
           WANTS_CURSOR_LATLON       |
           WANTS_TOOLBAR_CALLBACK    |
           INSTALLS_TOOLBAR_TOOL     |
           WANTS_CONFIG              |
           WANTS_PREFERENCES
            );
Thanks
Dave
bdbcat is offline   Reply With Quote
Old 04-07-2012, 18:00   #5
Registered User
 
david.tischler's Avatar

Join Date: Apr 2010
Boat: Ebbtide 36
Posts: 6
Re: Plugin with RenderOverlay in OpenCPN 3.0

Code:
return (
    WANTS_OVERLAY_CALLBACK  |
    WANTS_CURSOR_LATLON     |
    WANTS_TOOLBAR_CALLBACK  |
    INSTALLS_TOOLBAR_TOOL   |
    WANTS_CONFIG);
And as API version i tried 1.5 through 1.8, changing the base class respectively, and from 1.6 on used
Code:
virtual bool RenderOverlay(wxDC &dc, PlugIn_ViewPort *vp);
instead of
Code:
virtual bool RenderOverlay(wxMemoryDC *pmdc, PlugIn_ViewPort *vp);
david.tischler is offline   Reply With Quote
Old 04-07-2012, 18:34   #6
Registered User
 
david.tischler's Avatar

Join Date: Apr 2010
Boat: Ebbtide 36
Posts: 6
Re: Plugin with RenderOverlay in OpenCPN 3.0

I've put my code here: https://github.com/tischlda/positionreport_pi
david.tischler is offline   Reply With Quote
Old 04-07-2012, 22:24   #7
Registered User
 
david.tischler's Avatar

Join Date: Apr 2010
Boat: Ebbtide 36
Posts: 6
Re: Plugin with RenderOverlay in OpenCPN 3.0

I now pulled the latest OpenCPN source and compiled both OpenCPN and my plugin. Now RenderOverlay gets called, so somewhere between the version for 3.0.1 Beta Build 0703 and today there must have been a change that fixed this.

I see in the history of pluginmanger.cpp that there has lately been a fix for plugin API version 1.8 ('Fix plugin API RenderOverlay calls'), but why it won't work in the released 3.0.0 and 3.0.1 when using lower plugin API versions I can't find.
david.tischler is offline   Reply With Quote
Old 05-07-2012, 06:52   #8
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,523
Re: Plugin with RenderOverlay in OpenCPN 3.0

David....

Did you pull the latest master branch, or beta30_stable, or stable?
Which branch are you working on?

Dave
bdbcat is offline   Reply With Quote
Old 05-07-2012, 15:02   #9
Registered User
 
david.tischler's Avatar

Join Date: Apr 2010
Boat: Ebbtide 36
Posts: 6
Re: Plugin with RenderOverlay in OpenCPN 3.0

Pulled and tried it with master and beta30_stable, this time with plugin api version 1.6, in both the plugin works with OpenGL.

I even reset branch beta30_stable back to commit 'Correct Windows build', recompiled, and it still works in OpenGL mode (I see OpenGL-log messages and my RenderOverlay-logmessage in the logfile).

But it just won't work with the binaries available for download (currently having the beta release on my machine, reporting as Version 3.0.1 Build 2012-07-03 in opencpn.log).

If it makes any difference: I am using Windows.
david.tischler is offline   Reply With Quote
Reply

Tags
opencpn


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Advertise Here
  Vendor Spotlight
No Threads to Display.


All times are GMT -7. The time now is 22:54.


Google+
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Social Knowledge Networks
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.

ShowCase vBulletin Plugins by Drive Thru Online, Inc.