Update of /cvsroot/playerstage/code/stage/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9935/src

Modified Files:
      Tag: opengl
        gui_gl.c gui_gtk.cc matrix.c model.cc model_load.cc world.cc 
Log Message:
matrix rendering OK

Index: model.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/src/Attic/model.cc,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** model.cc    8 Jul 2007 01:44:09 -0000       1.1.2.1
--- model.cc    8 Jul 2007 05:24:04 -0000       1.1.2.2
***************
*** 38,41 ****
--- 38,43 ----
  //extern int _stg_disable_gui;
  
+ extern int dl_debug;
+ 
  /** @ingroup stage 
      @{ 
***************
*** 326,330 ****
--- 328,336 ----
    // now we can add the basic square shape
    this->AddBlockRect( 0,0,1,1 );
+ 
+   this->data = this->cfg = this->cmd = NULL;
    
+   this->subs = 0;
+ 
    // TODO!
    // now it's safe to create the GUI components
***************
*** 506,514 ****
        stg_matrix_block( this->world->matrix,
                          &org,
!                         (stg_block_t*)it->data );
!                         
      }
    else 
!     stg_matrix_remove_object( this->world->matrix, this ); // BUG - remove 
blocks, not models
  } 
  
--- 512,522 ----
        stg_matrix_block( this->world->matrix,
                          &org,
!                         (stg_block_t*)it->data );      
      }
    else 
!     // remove all the blcks from the matrix
!     if( blocks )
!       for( GList* it=blocks; it; it=it->next )
!       stg_matrix_remove_object( this->world->matrix, it->data ); 
  } 
  
***************
*** 593,598 ****
  void StgModel::Draw( void )
  {
!   printf( "%s.Draw()\n",
!         this->token );
  
    glPushMatrix();
--- 601,606 ----
  void StgModel::Draw( void )
  {
!   //printf( "%s.Draw()\n",
!   //  this->token );
  
    glPushMatrix();
***************
*** 602,606 ****
    gl_pose_shift( &this->geom.pose );
  
- 
    // todo - we don't need to do this so often
  
--- 610,613 ----

Index: world.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/src/Attic/world.cc,v
retrieving revision 1.154.2.1
retrieving revision 1.154.2.2
diff -C2 -d -r1.154.2.1 -r1.154.2.2
*** world.cc    8 Jul 2007 01:44:09 -0000       1.154.2.1
--- world.cc    8 Jul 2007 05:24:04 -0000       1.154.2.2
***************
*** 434,438 ****
                          StgModel*  mod  )
  {
!   printf( "World adding model %d %s to hash tables ", mod->id, mod->Token() 
);  
    g_hash_table_replace( world->models, &mod->id, mod );
    g_hash_table_replace( world->models_by_name, mod->Token(), mod );
--- 434,438 ----
                          StgModel*  mod  )
  {
!   //printf( "World adding model %d %s to hash tables ", mod->id, mod->Token() 
);  
    g_hash_table_replace( world->models, &mod->id, mod );
    g_hash_table_replace( world->models_by_name, mod->Token(), mod );
***************
*** 441,448 ****
    if( mod->Parent() == NULL )
      {
!       printf( "and child list", mod->id, mod->Token() );  
        world->children = g_list_append( world->children, mod );  
      }
!   puts("");
  }
  
--- 441,448 ----
    if( mod->Parent() == NULL )
      {
!       //printf( "and child list", mod->id, mod->Token() );  
        world->children = g_list_append( world->children, mod );  
      }
!   //puts("");
  }
  

Index: model_load.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/src/Attic/model_load.cc,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** model_load.cc       8 Jul 2007 01:44:09 -0000       1.1.2.1
--- model_load.cc       8 Jul 2007 05:24:04 -0000       1.1.2.2
***************
*** 186,194 ****
        this->blocks = NULL;
  
!       printf( "found %d rects\n", rect_count );
        
        if( rects && (rect_count > 0) )
        {
!         puts( "loading rects" );
          for( int r=0; r<rect_count; r++ )
            this->AddBlockRect( rects[r].pose.x, rects[r].pose.y, 
--- 186,194 ----
        this->blocks = NULL;
  
!       //printf( "found %d rects\n", rect_count );
        
        if( rects && (rect_count > 0) )
        {
!         //puts( "loading rects" );
          for( int r=0; r<rect_count; r++ )
            this->AddBlockRect( rects[r].pose.x, rects[r].pose.y, 
***************
*** 216,220 ****
        this->blocks = NULL;
  
!       printf( "expecting %d blocks\n", blockcount );
        
        char key[256]; 
--- 216,220 ----
        this->blocks = NULL;
  
!       //printf( "expecting %d blocks\n", blockcount );
        
        char key[256]; 
***************
*** 224,229 ****
            int pointcount = wf->ReadInt(this->id,key,0);
            
!           printf( "expecting %d points in block %d\n",
!             pointcount, l );
            
            stg_point_t* pts = stg_points_create( pointcount );
--- 224,229 ----
            int pointcount = wf->ReadInt(this->id,key,0);
            
!           //printf( "expecting %d points in block %d\n",
!           //pointcount, l );
            
            stg_point_t* pts = stg_points_create( pointcount );

Index: gui_gl.c
===================================================================
RCS file: /cvsroot/playerstage/code/stage/src/Attic/gui_gl.c,v
retrieving revision 1.1.2.24
retrieving revision 1.1.2.25
diff -C2 -d -r1.1.2.24 -r1.1.2.25
*** gui_gl.c    8 Jul 2007 02:08:53 -0000       1.1.2.24
--- gui_gl.c    8 Jul 2007 05:24:04 -0000       1.1.2.25
***************
*** 296,299 ****
--- 296,301 ----
        world->win->show_alpha = FALSE;
      }
+ 
+   world->win->dirty = true;
  }
  
***************
*** 486,496 ****
  void gl_model_selected( StgModel* mod, void* user )
  {
-   // get the display list associated with this model
-   //int list = gui_model_get_displaylist( mod, LIST_SELECTED );
-   
-   //glNewList( list, GL_COMPILE );
- 
    glPushMatrix();
-   //glPushAttrib( GL_ALL_ATTRIB_BITS );
  
    stg_pose_t pose;
--- 488,492 ----
***************
*** 500,506 ****
  
    gl_pose_shift( &pose );
  
-   push_color_rgba( 1, 0, 0, 1 );
-   
    double dx = geom.size.x / 2.0 * 1.3;
    double dy = geom.size.y / 2.0 * 1.3;
--- 496,501 ----
  
    gl_pose_shift( &pose );
+   gl_pose_shift( &geom.pose );
  
    double dx = geom.size.x / 2.0 * 1.3;
    double dy = geom.size.y / 2.0 * 1.3;
***************
*** 508,521 ****
    //glTranslatef( 0,0,0.1 );
  
    glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
    glRectf( -dx, -dy, dx, dy );
-   glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
  
    pop_color();
  
    glPopMatrix();
- 
-   //glPopAttrib();
-   //glEndList();
  }
  
--- 503,519 ----
    //glTranslatef( 0,0,0.1 );
  
+   //push_color_rgb( 1, 0.5, 0.5 );
+   //glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+   //glRectf( -dx, -dy, dx, dy );
+ 
+   push_color_rgb( 1, 0, 0 );
    glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+   glLineWidth( 2 );
    glRectf( -dx, -dy, dx, dy );
  
    pop_color();
+   //pop_color();
  
    glPopMatrix();
  }
  
***************
*** 810,814 ****
  void draw_world(  stg_world_t* world )
  {
!   puts( "draw_world" );
  
    gui_window_t* win = (gui_window_t*)world->win;
--- 808,812 ----
  void draw_world(  stg_world_t* world )
  {
!   //puts( "draw_world" );
  
    gui_window_t* win = (gui_window_t*)world->win;
***************
*** 928,931 ****
--- 926,938 ----
    //g_hash_table_foreach( world->models, (GHFunc)model_draw_bbox, NULL);
  
+   //glCallList( dl_debug );
+ 
+ /*   glTranslatef( 0,0,1 ); */
+ /*   glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); */
+ /*   push_color_rgb( 0,1,0 ); */
+ /*   stg_cell_render_tree( world->matrix->root ); */
+ /*   glTranslatef( 0,0,-1 ); */
+ /*   pop_color(); */
+ 
    g_list_foreach( world->win->selected_models, (GFunc)gl_model_selected, NULL 
);
  
***************
*** 947,952 ****
  
  
!   glCallList( dl_debug );
!   gl_coord_shift( 0,0,-2,0 );
  
    //if( win->show_thumbnail ) // if drawing the whole world mini-view
--- 954,958 ----
  
  
!   //gl_coord_shift( 0,0,-2,0 );
  
    //if( win->show_thumbnail ) // if drawing the whole world mini-view
***************
*** 1171,1175 ****
    
    // ctrl is pressed - choose this point as the center of rotation
!   printf( "mouse click at (%.2f %.2f %.2f)\n", obx, oby, obz );
    
    world->win->click_point.x = obx;
--- 1177,1181 ----
    
    // ctrl is pressed - choose this point as the center of rotation
!   //printf( "mouse click at (%.2f %.2f %.2f)\n", obx, oby, obz );
    
    world->win->click_point.x = obx;
***************
*** 1221,1227 ****
          if( (event->state & modifiers) != GDK_SHIFT_MASK)
            {
-             // shift is pressed 
-             printf( "SHIFT-click\n" );
-             
              g_list_free( world->win->selected_models );
              world->win->selected_models = NULL;
--- 1227,1230 ----

Index: gui_gtk.cc
===================================================================
RCS file: /cvsroot/playerstage/code/stage/src/Attic/gui_gtk.cc,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** gui_gtk.cc  8 Jul 2007 01:44:09 -0000       1.1.2.1
--- gui_gtk.cc  8 Jul 2007 05:24:04 -0000       1.1.2.2
***************
*** 1253,1257 ****
    if( world->win->dirty )
      {
!       puts( "Redrawing window" );
  
        /* Invalidate the whole window to trigger a redraw */
--- 1253,1257 ----
    if( world->win->dirty )
      {
!       //puts( "Redrawing window" );
  
        /* Invalidate the whole window to trigger a redraw */

Index: matrix.c
===================================================================
RCS file: /cvsroot/playerstage/code/stage/src/matrix.c,v
retrieving revision 1.22.4.4
retrieving revision 1.22.4.5
diff -C2 -d -r1.22.4.4 -r1.22.4.5
*** matrix.c    8 Jul 2007 01:44:09 -0000       1.22.4.4
--- matrix.c    8 Jul 2007 05:24:04 -0000       1.22.4.5
***************
*** 16,21 ****
  
  // a list of displaylists - add debug stuff to the list here
! extern GList* dl_list;
! //extern int dl_debug;
  
  stg_cell_t* stg_cell_create( stg_cell_t* parent, double x, double y, double 
size )
--- 16,21 ----
  
  // a list of displaylists - add debug stuff to the list here
! //extern GList* dl_list;
! extern int dl_debug;
  
  stg_cell_t* stg_cell_create( stg_cell_t* parent, double x, double y, double 
size )
***************
*** 53,57 ****
  {
    //puts( "cell render" );
!   glRectf( cell->x, cell->y, cell->x+cell->size, cell->y+cell->size );
  
    //printf( "cell %.2f,%.2f size %.2f\n", 
--- 53,62 ----
  {
    //puts( "cell render" );
! 
!   //glPolygonMode( GL_FRONT_AND_BACK, GL_LINES );
! 
!   double dx = cell->size/2.0;
! 
!   glRectf( cell->x-dx , cell->y-dx, cell->x+dx, cell->y+dx );
  
    //printf( "cell %.2f,%.2f size %.2f\n", 
***************
*** 59,73 ****
  }
  
! /* void stg_cell_render_tree( stg_cell_t* cell ) */
! /* { */
! /*   //stg_cell_render( cell ); */
! 
! /*   if( cell->children[0] ) */
! /*     { */
! /*       int i; */
! /*       for( i=0; i<4; i++ ) */
! /*    stg_cell_render_tree( cell->children[i] ); */
! /*     } */
! /* } */
  
  void stg_cell_unrender_tree( stg_cell_t* cell )
--- 64,78 ----
  }
  
! void stg_cell_render_tree( stg_cell_t* cell )
! {
!   stg_cell_render( cell );
!   
!   if( cell->children[0] )
!     {
!       int i;
!       for( i=0; i<4; i++ )
!       stg_cell_render_tree( cell->children[i] );
!     }
! }
  
  void stg_cell_unrender_tree( stg_cell_t* cell )
***************
*** 211,215 ****
        //printf( "matrix line %.2f,%.2f to %.2f,%.2f\n",
        //      x1,y1, x2, y2 );
! 
        // theta is constant so we compute it outside the loop
        double theta = atan2( y2-y1, x2-x1 );
--- 216,220 ----
        //printf( "matrix line %.2f,%.2f to %.2f,%.2f\n",
        //      x1,y1, x2, y2 );
!       
        // theta is constant so we compute it outside the loop
        double theta = atan2( y2-y1, x2-x1 );


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to