Revision: 6923
          http://playerstage.svn.sourceforge.net/playerstage/?rev=6923&view=rev
Author:   jeremy_asher
Date:     2008-07-24 19:22:12 +0000 (Thu, 24 Jul 2008)

Log Message:
-----------
stage: fixed polygon fill mode inconsistencies by setting Front&Back/Fill once 
and reverting to filled mode after changing to line mode every time

Modified Paths:
--------------
    code/stage/trunk/libstage/block.cc
    code/stage/trunk/libstage/canvas.cc
    code/stage/trunk/libstage/model.cc
    code/stage/trunk/libstage/model_blobfinder.cc
    code/stage/trunk/libstage/model_camera.cc
    code/stage/trunk/libstage/model_fiducial.cc
    code/stage/trunk/libstage/model_laser.cc
    code/stage/trunk/libstage/model_ranger.cc

Modified: code/stage/trunk/libstage/block.cc
===================================================================
--- code/stage/trunk/libstage/block.cc  2008-07-24 18:45:15 UTC (rev 6922)
+++ code/stage/trunk/libstage/block.cc  2008-07-24 19:22:12 UTC (rev 6923)
@@ -99,7 +99,6 @@
        // draw filled color polygons  
        stg_color_t color = Color();
 
-       glPolygonMode(GL_FRONT_AND_BACK, GL_FILL );
        PushColor( color );
        glEnable(GL_POLYGON_OFFSET_FILL);
        glPolygonOffset(1.0, 1.0);
@@ -112,19 +111,19 @@
        stg_color_unpack( color, &r, &g, &b, &a );
        PushColor( stg_color_pack( r/2.0, g/2.0, b/2.0, a ));
 
-       glPolygonMode(GL_FRONT_AND_BACK, GL_LINE );
+       glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
        glDepthMask(GL_FALSE);
        DrawTop();
        DrawSides();
        glDepthMask(GL_TRUE);
-
+       glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
+       
        PopColor();
        PopColor();
 }
 
 void StgBlock::DrawSolid( void )
 {
-       glPolygonMode(GL_FRONT_AND_BACK, GL_FILL );
        DrawSides();
        DrawTop();
 }

Modified: code/stage/trunk/libstage/canvas.cc
===================================================================
--- code/stage/trunk/libstage/canvas.cc 2008-07-24 18:45:15 UTC (rev 6922)
+++ code/stage/trunk/libstage/canvas.cc 2008-07-24 19:22:12 UTC (rev 6923)
@@ -91,10 +91,9 @@
   make_current(); // make sure the GL context is current
   glClearColor ( 1,1,1,1 ); // white
   glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
-  glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
-       glLoadIdentity();
-       current_camera->SetProjection();
-       current_camera->Draw();
+  glLoadIdentity();
+  current_camera->SetProjection();
+  current_camera->Draw();
 
   glDisable(GL_DITHER);
   glDisable(GL_BLEND); // turns off alpha blending, so we read back
@@ -466,8 +465,6 @@
 
 void StgCanvas::DrawGlobalGrid()
 {
-
-  glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
   stg_bounds3d_t bounds = world->GetExtent();
 
   char str[16];        
@@ -519,7 +516,6 @@
   stg_bounds3d_t bounds = world->GetExtent();
   float z = 0;
        
-  glPolygonMode(GL_FRONT_AND_BACK, GL_FILL );
   glEnable(GL_POLYGON_OFFSET_FILL);
   glPolygonOffset(2.0, 2.0);
        
@@ -623,6 +619,7 @@
        ((StgWorldGui*)world)->DrawTree( true );
                
       colorstack.Pop();
+         glPolygonMode( GL_FRONT, GL_FILL );
       glPopMatrix();
     }
   
@@ -632,7 +629,6 @@
   if( showFootprints )
     {
       glDisable( GL_DEPTH_TEST );
-      glPolygonMode(GL_FRONT_AND_BACK, GL_FILL );
                
                for( std::multimap< float, StgModel* >::reverse_iterator i = 
ordered.rbegin(); i != ordered.rend(); i++ ) {
                        i->second->DrawTrailFootprint();
@@ -642,12 +638,9 @@
   
   if( showTrailRise )
     {
-      glPolygonMode(GL_FRONT_AND_BACK, GL_FILL );
-               
                for( std::multimap< float, StgModel* >::reverse_iterator i = 
ordered.rbegin(); i != ordered.rend(); i++ ) {
                        i->second->DrawTrailBlocks();
                }
-               
     }
   
   if( showTrailArrows )
@@ -743,8 +736,6 @@
 
       // if trails are on, we need to clear the clock background
 
-      glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
-
                std::string clockstr = world->ClockString();
                if( showFollow == true && last_selection )
                        clockstr.append( " [ FOLLOW MODE ]" );
@@ -954,7 +945,8 @@
       glHint( GL_LINE_SMOOTH_HINT, GL_FASTEST );
       glDepthMask( GL_TRUE );
       glEnable( GL_TEXTURE_2D );
-               glEnableClientState( GL_VERTEX_ARRAY );
+         glEnableClientState( GL_VERTEX_ARRAY );
+         glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
 
       //TODO find a better home for loading textures
       if( loaded_texture == false ) {

Modified: code/stage/trunk/libstage/model.cc
===================================================================
--- code/stage/trunk/libstage/model.cc  2008-07-24 18:45:15 UTC (rev 6922)
+++ code/stage/trunk/libstage/model.cc  2008-07-24 19:22:12 UTC (rev 6923)
@@ -785,17 +785,15 @@
       stg_color_unpack( checkpoint->color, &r, &g, &b, &a );
       PushColor( r, g, b, 0.1 );
 
-      glPolygonMode(GL_FRONT_AND_BACK, GL_FILL );
       LISTMETHOD( this->blocks, StgBlock*, DrawFootPrint );
 
-      glPolygonMode(GL_FRONT_AND_BACK, GL_LINE );
+      glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
       PushColor( r/2, g/2, b/2, 0.1 );
       LISTMETHOD( this->blocks, StgBlock*, DrawFootPrint );
 
-      glPolygonMode(GL_FRONT_AND_BACK, GL_FILL );
-
       PopColor();
       PopColor();
+         glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
       glPopMatrix();
     }
 }
@@ -840,7 +838,6 @@
 
       PushColor( checkpoint->color );
 
-      glPolygonMode(GL_FRONT_AND_BACK, GL_FILL );
       glEnable(GL_POLYGON_OFFSET_FILL);
       glPolygonOffset(1.0, 1.0);
 
@@ -851,7 +848,7 @@
       glEnd();
       glDisable(GL_POLYGON_OFFSET_FILL);
 
-      glPolygonMode(GL_FRONT_AND_BACK, GL_LINE );
+      glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
 
       stg_color_unpack( checkpoint->color, &r, &g, &b, &a );
       PushColor( r/2, g/2, b/2, 1 ); // darker color
@@ -864,6 +861,7 @@
       glEnd();
       glDepthMask(GL_TRUE);
 
+         glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
       PopColor();
       PopColor();
       PopCoords();
@@ -1091,7 +1089,6 @@
 
   glEnable(GL_TEXTURE_2D);
   glBindTexture( GL_TEXTURE_2D, texture_id );
-  glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
 
   glColor4f( 1.0, 1.0, 1.0, alpha );
   glPushMatrix();
@@ -1144,7 +1141,6 @@
                
                
                PushColor( flag->color );
-               glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
                
                gluQuadricDrawStyle( quadric, GLU_FILL );
                gluSphere( quadric, flag->size/2.0, 4,2  );
@@ -1180,8 +1176,6 @@
   //stg_pose_t gpose = GetGlobalPose();
   //glRotatef( 180 + rtod(-gpose.a),0,0,1 );
 
-  //glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
-
   for( unsigned int i=0; i<blinkenlights->len; i++ )
     {
       stg_blinkenlight_t* b = 

Modified: code/stage/trunk/libstage/model_blobfinder.cc
===================================================================
--- code/stage/trunk/libstage/model_blobfinder.cc       2008-07-24 18:45:15 UTC 
(rev 6922)
+++ code/stage/trunk/libstage/model_blobfinder.cc       2008-07-24 19:22:12 UTC 
(rev 6923)
@@ -308,7 +308,6 @@
                PushColor( 0,0,0,0.2  );
 
                gluQuadricDrawStyle( quadric, GLU_SILHOUETTE );
-               //glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
                gluPartialDisk( quadric,
                                0, 
                                range,
@@ -337,7 +336,6 @@
        glScalef( 0.025, 0.025, 1 );
 
        // draw a white screen with a black border
-       glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
        PushColor( 0xFFFFFFFF );
        glRectf( 0,0, scan_width, scan_height );
        PopColor();
@@ -350,7 +348,6 @@
        PopColor();
 
        // draw the blobs on the screen
-       glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
        for( unsigned int s=0; s<blobs->len; s++ )
        {
                stg_blobfinder_blob_t* b = 
@@ -362,7 +359,8 @@
                //printf( "%u l %u t%u r %u b %u\n", s, b->left, b->top, 
b->right, b->bottom );
                PopColor();
        }
-
+       
+       glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
        glPopMatrix();
 }
 

Modified: code/stage/trunk/libstage/model_camera.cc
===================================================================
--- code/stage/trunk/libstage/model_camera.cc   2008-07-24 18:45:15 UTC (rev 
6922)
+++ code/stage/trunk/libstage/model_camera.cc   2008-07-24 19:22:12 UTC (rev 
6923)
@@ -285,7 +285,6 @@
        }
        
        glDisable( GL_CULL_FACE );
-       glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
        //glBegin( GL_QUADS );
        
        

Modified: code/stage/trunk/libstage/model_fiducial.cc
===================================================================
--- code/stage/trunk/libstage/model_fiducial.cc 2008-07-24 18:45:15 UTC (rev 
6922)
+++ code/stage/trunk/libstage/model_fiducial.cc 2008-07-24 19:22:12 UTC (rev 
6923)
@@ -259,7 +259,7 @@
        //    PushColor( 0,0,0,0.2  );
 
        //    gluQuadricDrawStyle( quadric, GLU_SILHOUETTE );
-       //    //glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
+
        //    gluPartialDisk( quadric,
        //                 0, 
        //                 max_range_anon,
@@ -293,7 +293,7 @@
                glPushMatrix();
                gl_coord_shift( dx,dy,0,fid.geom.a );
 
-               glPolygonMode( GL_FRONT, GL_LINE );
+               glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
                glRectf( -fid.geom.x/2.0, -fid.geom.y/2.0,
                                fid.geom.x/2.0, fid.geom.y/2.0 );
 
@@ -305,6 +305,7 @@
                gl_draw_string( 0,0,0, idstr );
                PopColor();
 
+               glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
                glPopMatrix();
 
                PopColor();

Modified: code/stage/trunk/libstage/model_laser.cc
===================================================================
--- code/stage/trunk/libstage/model_laser.cc    2008-07-24 18:45:15 UTC (rev 
6922)
+++ code/stage/trunk/libstage/model_laser.cc    2008-07-24 19:22:12 UTC (rev 
6923)
@@ -353,7 +353,6 @@
       PopColor();
       
       glDepthMask( GL_FALSE );
-      glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
       
       // draw the filled polygon in transparent blue
       PushColor( 0, 0, 1, 0.1 );               

Modified: code/stage/trunk/libstage/model_ranger.cc
===================================================================
--- code/stage/trunk/libstage/model_ranger.cc   2008-07-24 18:45:15 UTC (rev 
6922)
+++ code/stage/trunk/libstage/model_ranger.cc   2008-07-24 19:22:12 UTC (rev 
6923)
@@ -328,7 +328,6 @@
 
        if( showRangerTransducers )
          {
-                glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
                 PushColor( 0,0,0,1 );
                 
                 for( unsigned int s=0; s<sensor_count; s++ ) 
@@ -384,7 +383,6 @@
        
        // draw the filled triangles in transparent blue
        glDepthMask( GL_FALSE );
-       glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
        PushColor( 0, 1, 0, 0.1 ); // transparent pale green       
        //glEnableClientState( GL_VERTEX_ARRAY );
        glVertexPointer( 3, GL_FLOAT, 0, pts );


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Playerstage-commit mailing list
Playerstage-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to