Exemple #1
0
  Mesh::Mesh( 
      int res, 
      int depth_width, 
      int depth_height,
      int tex_width, 
      int tex_height )
  {
    this->res = res;
    this->depth_width = depth_width;

    width = (float)depth_width / res;
    height = (float)depth_height / res;
    mesh_len = width * height;
    ibo_len = mesh_len * 6;

    init_ibo();
    init_texcoords(tex_width,tex_height);
    init_colors();        
    init_pts();

    vbo.setVertexData( &(pts3d)[0].x, 3, mesh_len, /*GL_STATIC_DRAW*/ GL_DYNAMIC_DRAW, sizeof(ofVec3f) );
    //vbo.setNormalData( normals0x(), mesh_len, GL_DYNAMIC_DRAW, sizeof_normals() );
    vbo.setIndexData( ibo, ibo_len, GL_STATIC_DRAW );
    vbo.setColorData( colors, mesh_len, GL_STATIC_DRAW );
    vbo.setTexCoordData( texcoords, mesh_len, GL_STATIC_DRAW );
  }
  Mesh::Mesh( 
      int step, 
      int depth_width, int depth_height,
      int tex_width, int tex_height )
  {
    this->step = step;
    this->depth_width = depth_width;

    width = (float)depth_width / step;
    height = (float)depth_height / step;
    mesh_len = width * height;
    ibo_len = mesh_len * 4;

    init_ibo();
    init_texcoords( tex_width, tex_height );
    init_colors();        
    init_pts();

    // init vbo

    vbo.setVertexData( pts0x(), 3, mesh_len, 
        GL_DYNAMIC_DRAW, sizeof_pts() );

    //vbo.setNormalData( normals0x(), mesh_len, GL_DYNAMIC_DRAW, sizeof_normals() );

    vbo.setIndexData( ibo, 
        ibo_len, GL_STATIC_DRAW );

    vbo.setColorData( vbo_color, 
        mesh_len, GL_STATIC_DRAW );

    vbo.setTexCoordData( vbo_texcoords, 
        mesh_len, GL_STATIC_DRAW );
  }