Cruisers Forum
 


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 15-05-2014, 19:36   #91
Registered User

Join Date: Aug 2009
Location: oriental
Boat: crowther trimaran 33
Posts: 4,417
Re: Sean's Optimum Branch Merge

Quote:
Originally Posted by bdbcat View Post
Sean...

On Mac, with texture compression, we see incomplete patches in quilt mode. No crashes. Pix attached.

On linux, skewed charts, quilt mode, OpenGL: some problem with clip region when zooming in, pix attached.


Dave
Dave,

Doesn't macos use a different region class? Maybe this is the cause?

I tried to make it possible to draw the world background chart in skewed mode (which should be possible) but has limitations when opengl is not used depending on rotation. For both cases, we can use git bisect to find where things went wrong.

I have a lingering diff in my optimum branch I never submitted because I can't remember the test cases where it matters, so wanted to avoid changes that are not needed, maybe this fixes it? If it does.. we should really fix things to avoid coordinate differences for opengl.

Code:
diff --git a/src/chartimg.cpp b/src/chartimg.cpp
index 1f47986..e3dbd3a 100644
--- a/src/chartimg.cpp
+++ b/src/chartimg.cpp
@@ -3084,26 +3084,41 @@ void ChartBaseBSB::GetValidCanvasRegion(const ViewPort& VPoint, OCPNRegion *pVal
       double raster_scale =  VPoint.view_scale_ppm / GetPPM();
 
       int rxl, rxr;
-      if(Rsrc.x < 0)
-            rxl = (int)(-Rsrc.x * raster_scale);
-      else
+      int ryb, ryt;
+
+      /* TODO: the original version works in non opengl mode,
+         the next one is needed for opengl.  This is needed for rotated
+         viewports.. without rotation.. either version is the same.
+         This should be modified so we can not make a distinction here
+         for opengl and use the same coordinates correct? */
+      extern bool g_bopengl;
+      if(!g_bopengl) {
+          if(Rsrc.x < 0)
+              rxl = (int)(-Rsrc.x * raster_scale);
+          else
             rxl = 0;
 
-      if(((Size_X - Rsrc.x) * raster_scale) < VPoint.pix_width)
-            rxr = (int)((Size_X - Rsrc.x) * raster_scale);
-      else
-            rxr = VPoint.pix_width;
+          if(((Size_X - Rsrc.x) * raster_scale) < VPoint.pix_width)
+              rxr = (int)((Size_X - Rsrc.x) * raster_scale);
+          else
+              rxr = VPoint.pix_width;
 
-      int ryb, ryt;
-      if(Rsrc.y < 0)
-            ryt = (int)(-Rsrc.y * raster_scale);
-      else
-            ryt = 0;
+          if(Rsrc.y < 0)
+              ryt = (int)(-Rsrc.y * raster_scale);
+          else
+              ryt = 0;
+          
+          if(((Size_Y - Rsrc.y) * raster_scale) < VPoint.pix_height)
+              ryb = (int)((Size_Y - Rsrc.y) * raster_scale);
+          else
+              ryb = VPoint.pix_height;
+      } else {
+          rxl = wxMax(-Rsrc.x * raster_scale, VPoint.rv_rect.x);
+          rxr = wxMin((Size_X - Rsrc.x) * raster_scale, VPoint.rv_rect.width + VPoint.rv_rect.x);
 
-      if(((Size_Y - Rsrc.y) * raster_scale) < VPoint.pix_height)
-            ryb = (int)((Size_Y - Rsrc.y) * raster_scale);
-      else
-            ryb = VPoint.pix_height;
+          ryt = wxMax(-Rsrc.y * raster_scale, VPoint.rv_rect.y);
+          ryb = wxMin((Size_Y - Rsrc.y) * raster_scale, VPoint.rv_rect.height + VPoint.rv_rect.y);
+      }
 
       pValidRegion->Clear();
       pValidRegion->Union(rxl, ryt, rxr - rxl, ryb - ryt);
seandepagnier is offline   Reply With Quote
Old 15-05-2014, 22:03   #92
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,147
Re: Sean's Optimum Branch Merge

Quote:
Originally Posted by boat_alexandra View Post
........I'm not sure we need this. Maybe, by default texture compression caching should be disabled. You get a time estimation (not very accurate) once the operation starts. It is possible to click the skip button to abort. Also, it is possible to make the generation work without blocking the program, although it will slow the whole computer down a lot.
-Slow the computer down- Well, it's not possible to slow more then what's already done. I'm now on the eighth hours and another four is estimated all using 99% processing time. For a beta it's of course ok but we have to agree how to handle this before presenting it to a "normal" user. Now let's see if the process will let me post this reply
Hakan is offline   Reply With Quote
Old 15-05-2014, 22:35   #93
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,147
Re: Sean's Optimum Branch Merge

Some extra mark symbols are colour inverted and not sized. They are oversized in a overview zoom scale. Maybe they are not built to be used in OpenGL?
Attached Thumbnails
Click image for larger version

Name:	WP_symbol.jpg
Views:	120
Size:	211.3 KB
ID:	81376  
Hakan is offline   Reply With Quote
Old 15-05-2014, 23:05   #94
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,147
Re: Sean's Optimum Branch Merge

Win32, KAP-files and CM93
To complete Dave's post above. In some zoom levels the background chart is shown around one chart instead of surrounding KAPs or CM93. From the the red lines it's obvious there should have been other charts to view.
Attached Thumbnails
Click image for larger version

Name:	Window Capture.jpg
Views:	122
Size:	315.1 KB
ID:	81377  
Hakan is offline   Reply With Quote
Old 16-05-2014, 06:59   #95
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,401
Re: Sean's Optimum Branch Merge

Sean...

The diff you supplied did the trick for OpenGL. And it turns out to work the same for DC mode as well, so I simplified the method to not care about display mode. The TODO is done, in github now.

Thanks
Dave
bdbcat is offline   Reply With Quote
Old 16-05-2014, 07:07   #96
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,401
Re: Sean's Optimum Branch Merge

Sean, et al..

I changed the default for texture compression to "OFF" for now, so that we can test incrementally.

Dave
bdbcat is offline   Reply With Quote
Old 16-05-2014, 09:24   #97
Registered User

Join Date: Apr 2009
Location: Marina Del Rey
Boat: Hylas 44
Posts: 387
Re: Sean's Optimum Branch Merge

Here are a few patches.

The first one deals with the arrow heads on selected and active routes.

Code:
diff --git a/src/Route.cpp b/src/Route.cpp
index 59fb801..9f4d6a1 100644
--- a/src/Route.cpp
+++ b/src/Route.cpp
@@ -481,11 +481,11 @@ void Route::DrawGL( ViewPort &VP )
     wxPoint rpt1, rpt2;
     while(node) {
         RoutePoint *prp = node->GetData();
-        node = node->GetNext();
         cc1->GetCanvasPointPix( prp->m_lat, prp->m_lon, &rpt2 );
         if(node != pRoutePointList->GetFirst())
             RenderSegmentArrowsGL( rpt1.x, rpt1.y, rpt2.x, rpt2.y, cc1->GetVP() );
         rpt1 = rpt2;
+        node = node->GetNext();
     }
 #endif
 }
@@ -598,12 +598,12 @@ void Route::RenderSegmentArrowsGL( int xa, int ya, int xb, int yb, ViewPort &VP)
             / nom_arrow_size;
 
     float theta = atan2f( (float)yb - ya, (float)xb - xa );
-    theta -= PI / 2;
+    theta -= PI ;
 
     glPushMatrix();
-    glScalef(icon_scale_factor, icon_scale_factor, 1);
-    glRotatef(theta * 180/PI, 0, 0, 1);
     glTranslatef(xb, yb, 0);
+    glScalef(icon_scale_factor, icon_scale_factor, 1);
+    glRotatef(theta * 180/PI, 0, 0, 1);    
 
     glBegin(GL_POLYGON);
     for( int i = 0; i < 14; i+=2 )
This one deals with flashing displays when routes and AIS targets are rolled over.

Code:
diff --git a/src/chcanv.cpp b/src/chcanv.cpp
index 743590b..f2f4d8c 100644
--- a/src/chcanv.cpp
+++ b/src/chcanv.cpp
@@ -2471,7 +2471,7 @@ void ChartCanvas::OnRolloverPopupTimerEvent( wxTimerEvent& event )
                     m_RolloverPopupTimer.Start( 50, wxTIMER_ONE_SHOT );
                     m_pAISRolloverWin->IsActive( false );
                     m_AISRollover_MMSI = 0;
-                    Refresh();
+                    Refresh(false);
                     return;
                 }
 
@@ -2620,7 +2620,7 @@ void ChartCanvas::OnRolloverPopupTimerEvent( wxTimerEvent& event )
     }
 
     if( b_need_refresh )
-        Refresh();
+        Refresh(false);
 }
This fixes the disappearing waypoints on selected and active routes.

Code:
diff --git a/src/glChartCanvas.cpp b/src/glChartCanvas.cpp
index 0b83557..6358a52 100755
--- a/src/glChartCanvas.cpp
+++ b/src/glChartCanvas.cpp
@@ -1515,7 +1515,7 @@ void glChartCanvas::DrawAllRoutesAndWaypoints( ViewPort &vp, OCPNRegion &region
         for(wxRoutePointListNode *pnode = pWayPointMan->GetWaypointList()->GetFirst();
             pnode; pnode = pnode->GetNext() ) {
             RoutePoint *pWP = pnode->GetData();
-            if( pWP && !pWP->m_bIsInRoute && !pWP->m_bIsInTrack )
+            if( pWP /*&& !pWP->m_bIsInRoute && !pWP->m_bIsInTrack*/ )
                 pWP->DrawGL( vp, region );
         }
 }
Chuck
ChuckSK is offline   Reply With Quote
Old 16-05-2014, 09:44   #98
Registered User

Join Date: Apr 2009
Location: Marina Del Rey
Boat: Hylas 44
Posts: 387
Re: Sean's Optimum Branch Merge

There is a problem using textures for chart symbols.

When ChartSymbols::LoadRasterFileForColorTable is called in the start-up process, g_texture_rectangle_format has not yet been set. This generates a warning message in the log file--Warning: unable to use texture for chart symbols. So, in s52plib::RenderRasterSymbol a texture is not found.

If using OpenGL is de-selected and then re_selected, g_texture_rectangle_format is set before ChartSymbols::LoadRasterFileForColorTable is called and all is well.

Chuck
ChuckSK is offline   Reply With Quote
Old 16-05-2014, 21:35   #99
Registered User

Join Date: Aug 2009
Location: oriental
Boat: crowther trimaran 33
Posts: 4,417
Re: Sean's Optimum Branch Merge

Quote:
Originally Posted by Hakan View Post
Win32, KAP-files and CM93
To complete Dave's post above. In some zoom levels the background chart is shown around one chart instead of surrounding KAPs or CM93. From the the red lines it's obvious there should have been other charts to view.
Can you verify that this problem didn't exist before? If so, could you use git-bisect to determine which commit broke things?

Does anyone else experience this?

Quote:
Originally Posted by ChuckSK View Post
There is a problem using textures for chart symbols.

When ChartSymbols::LoadRasterFileForColorTable is called in the start-up process, g_texture_rectangle_format has not yet been set. This generates a warning message in the log file--Warning: unable to use texture for chart symbols. So, in s52plib::RenderRasterSymbol a texture is not found.

If using OpenGL is de-selected and then re_selected, g_texture_rectangle_format is set before ChartSymbols::LoadRasterFileForColorTable is called and all is well.

Chuck
This is because Dave added setting the color scheme to vector charts earlier in the program (needed for the s63 charts) which now happens before the glChartCanvas is initialized... This needs to happen a bit later somehow.

I also found a crash if your disk is completely full when you exit the program.. and it's not obvious what the cause is.

Quote:
Originally Posted by ChuckSK View Post
Here are a few patches.

The first one deals with the arrow heads on selected and active routes.

Code:
diff --git a/src/Route.cpp b/src/Route.cpp
index 59fb801..9f4d6a1 100644
--- a/src/Route.cpp
+++ b/src/Route.cpp
@@ -481,11 +481,11 @@ void Route::DrawGL( ViewPort &VP )
     wxPoint rpt1, rpt2;
     while(node) {
         RoutePoint *prp = node->GetData();
-        node = node->GetNext();
         cc1->GetCanvasPointPix( prp->m_lat, prp->m_lon, &rpt2 );
         if(node != pRoutePointList->GetFirst())
             RenderSegmentArrowsGL( rpt1.x, rpt1.y, rpt2.x, rpt2.y, cc1->GetVP() );
         rpt1 = rpt2;
+        node = node->GetNext();
     }
 #endif
 }
@@ -598,12 +598,12 @@ void Route::RenderSegmentArrowsGL( int xa, int ya, int xb, int yb, ViewPort &VP)
             / nom_arrow_size;
 
     float theta = atan2f( (float)yb - ya, (float)xb - xa );
-    theta -= PI / 2;
+    theta -= PI ;
 
     glPushMatrix();
-    glScalef(icon_scale_factor, icon_scale_factor, 1);
-    glRotatef(theta * 180/PI, 0, 0, 1);
     glTranslatef(xb, yb, 0);
+    glScalef(icon_scale_factor, icon_scale_factor, 1);
+    glRotatef(theta * 180/PI, 0, 0, 1);    
 
     glBegin(GL_POLYGON);
     for( int i = 0; i < 14; i+=2 )
[/code]

This fixes the disappearing waypoints on selected and active routes.

Code:
diff --git a/src/glChartCanvas.cpp b/src/glChartCanvas.cpp
index 0b83557..6358a52 100755
--- a/src/glChartCanvas.cpp
+++ b/src/glChartCanvas.cpp
@@ -1515,7 +1515,7 @@ void glChartCanvas::DrawAllRoutesAndWaypoints( ViewPort &vp, OCPNRegion &region
         for(wxRoutePointListNode *pnode = pWayPointMan->GetWaypointList()->GetFirst();
             pnode; pnode = pnode->GetNext() ) {
             RoutePoint *pWP = pnode->GetData();
-            if( pWP && !pWP->m_bIsInRoute && !pWP->m_bIsInTrack )
+            if( pWP /*&& !pWP->m_bIsInRoute && !pWP->m_bIsInTrack*/ )
                 pWP->DrawGL( vp, region );
         }
 }
Good, catch.. I don't know what I was thinking. This code actually meant to be used for all routes, not just selected ones.
Quote:
This one deals with flashing displays when routes and AIS targets are rolled over.

Code:
diff --git a/src/chcanv.cpp b/src/chcanv.cpp
index 743590b..f2f4d8c 100644
--- a/src/chcanv.cpp
+++ b/src/chcanv.cpp
@@ -2471,7 +2471,7 @@ void ChartCanvas::OnRolloverPopupTimerEvent( wxTimerEvent& event )
                     m_RolloverPopupTimer.Start( 50, wxTIMER_ONE_SHOT );
                     m_pAISRolloverWin->IsActive( false );
                     m_AISRollover_MMSI = 0;
-                    Refresh();
+                    Refresh(false);
                     return;
                 }
 
@@ -2620,7 +2620,7 @@ void ChartCanvas::OnRolloverPopupTimerEvent( wxTimerEvent& event )
     }
 
     if( b_need_refresh )
-        Refresh();
+        Refresh(false);
 }
Chuck
This is not specific to the optimum branch is it? In any case I don't get a flashing display, and I think this should be re-implemented to not use a rollover window in opengl mode to do more correct alpha blending without needing to grab pixels...
seandepagnier is offline   Reply With Quote
Old 17-05-2014, 05:56   #100
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,401
Re: Sean's Optimum Branch Merge

Sean/Chuck...

I changed again the initialization sequence for the S52Plib raster symbol table load. Should be OK now. There is a nagging circle condition here, leading to unnecessary module dependencies. IMHO, it would be cleaner if the OpenGL setup code could be run long before the first actual glChartCanvas::OnPaint() method, and sometime before the PlugIns are loaded, as well.

Dave
bdbcat is offline   Reply With Quote
Old 17-05-2014, 09:43   #101
Registered User

Join Date: Apr 2009
Location: Marina Del Rey
Boat: Hylas 44
Posts: 387
Re: Sean's Optimum Branch Merge

Sean

The screen still flashes during AIS target rollover. Route rollover is fixed.

Chuck
ChuckSK is offline   Reply With Quote
Old 17-05-2014, 12:09   #102
Registered User

Join Date: Dec 2005
Location: Helsingborg
Boat: Dufour 35
Posts: 3,891
Re: Sean's Optimum Branch Merge

Quote:
Originally Posted by ChuckSK View Post
Sean

The screen still flashes during AIS target rollover. Route rollover is fixed.

Chuck
No problems with rollover on Linux.
After yesterdays or today’s updates, a routes way-points are still visible after after hiding the route in the route manager.
Thomas
cagney is offline   Reply With Quote
Old 17-05-2014, 19:29   #103
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,401
Re: Sean's Optimum Branch Merge

Hello testers...

A couple of changes committed to improve usability of routes/wps and routemanagerdialog, especially if OpenGL Frame Buffer Objects are enabled.

Please keep the test reports coming, no matter how arcane. There is a lot of regression ground to cover here.

Enjoy
Dave
bdbcat is offline   Reply With Quote
Old 17-05-2014, 20:07   #104
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,401
Re: Sean's Optimum Branch Merge

Chuck, et al...

Latest commit corrects MSW OpenGL flashing on rollover and Refresh().

Thanks
Dave
bdbcat is offline   Reply With Quote
Old 17-05-2014, 23:00   #105
Registered User

Join Date: Aug 2009
Location: oriental
Boat: crowther trimaran 33
Posts: 4,417
Re: Sean's Optimum Branch Merge

For windows users who want to do some testing... I have built installers for windows here:

https://sourceforge.net/projects/ope..._experimental/

Keep in mind this is using mingw compiler (cross compiled under linux) so it could potentially have "other" problems. I tried to build a 64bit binary and it always seems to crash when starting (I think there are several windows-specific bugs for 64bits) It will use sse2 instructions though, and should be faster than the visual studio build for several reasons. Keep in mind I'm using wine windows, not microsoft windows for testing.


Another thing.. I noticed in the code:
Code:
    //    On MSW, force the entire process to run on one CPU core only                              
    //    This resolves some difficulty with wxThread syncronization
Dave or anyone, do you know why we have this? I changed it from all windows to visual studio only (so the above download doesn't do this on windows) as this has serious negative implications for users with smp systems. For example, cpu hungry operations like generating the compressed cache or weather routing both take advantage of multiple threads, but this undermines it.


There are _several_ really annoying bugs related to the region class which caused many crashes only when optimizations were enabled... wxWidgets uses different region classes for each platform which seems strange to me because it should be a portable feature. In any case, the windows (when compiled with -O) (and probably mac) versions appear to exhibit undefined behavior in certain circumstances. I fixed all of this by just using the builtin gdk version which is already in opencpn and probably more efficient anyway. It had a few features left out which would explain issues on macosx.
seandepagnier is offline   Reply With Quote
Reply


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Two-pole branch protection witzgall Electrical: Batteries, Generators & Solar 12 19-11-2013 08:53
Optimum Dagger Board Use solarbri Multihull Sailboats 15 03-03-2013 13:56
Linux link error on master branch teotwawki OpenCPN 4 19-10-2012 06:13
VHF antenna optimum height bobalpep Marine Electronics 13 04-03-2009 09:38
Marine Accident Investigation Branch (UK Govt) David_Old_Jersey Health, Safety & Related Gear 3 05-02-2007 15:30

Advertise Here


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


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.