Changeset 20 for branches

Show
Ignore:
Timestamp:
02/29/08 22:07:19 (4 years ago)
Author:
sokoow
Message:

Added:

-GL call lists at cube model

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/pdfcube-0.0.3/src/pdfcube.cc

    r18 r20  
    2626#include <cmath> 
    2727#include <sstream> 
    28  
     28#define NDEBUG 
    2929// Gtk+ (pkg-config gtk+-2.0) 
    3030#include <gtk/gtk.h> 
     
    114114    texmap[1] = 1; 
    115115    texmap[2] = 2; 
     116    cube_faces=0; 
    116117    pixmap = 
    117118      gdk_pixbuf_new(GDK_COLORSPACE_RGB, true, 8, tex_width, 
     
    179180    for (ii = 0; ii < total_pages; ++ii) { 
    180181      if (page_transition[ii]) 
    181         ection--; 
     182        section--; 
    182183      if (section == 0) 
    183184        break; 
     
    220221    glDisable(GL_DEPTH_TEST); 
    221222 
    222     glEnable(GL_DEPTH_TEST); 
    223     glDepthFunc(GL_LEQUAL); 
     223//    glEnable(GL_DEPTH_TEST); 
     224//    glDepthFunc(GL_LEQUAL); 
    224225    glLightfv(GL_LIGHT0, GL_POSITION, position); 
    225226    glLightModelfv(GL_LIGHT_MODEL_LOCAL_VIEWER, local_view); 
     
    285286 
    286287    matrix_setup(); 
     288    buildLists(); 
    287289  } 
    288290 
     
    10061008  // OpenGL Textures 
    10071009  GLuint textures[3]; 
     1010  GLuint cube_faces; 
    10081011 
    10091012  // Width and Height of the rendered pixmap (aspect 
     
    10221025                                  1.0 * iWidth / w, 0, pm); 
    10231026  } 
     1027 
     1028void buildLists() 
     1029{ 
     1030    int i; 
     1031  cube_faces=glGenLists(6); 
     1032 
     1033    for (i = 0; i < 6; i++) { 
     1034      glNewList(cube_faces+i,GL_COMPILE); 
     1035      glBegin(GL_QUADS); 
     1036      glTexCoord2f((1.0 - mapping[i][4]) * tex_width, 
     1037                   mapping[i][5] * tex_height); 
     1038      glVertex3fv(&v[faces[i][0]][0]); 
     1039 
     1040      glTexCoord2f((1.0 - mapping[i][6]) * tex_width, 
     1041                   mapping[i][7] * tex_height); 
     1042      glVertex3fv(&v[faces[i][1]][0]); 
     1043 
     1044      glTexCoord2f((1.0 - mapping[i][0]) * tex_width, 
     1045                   mapping[i][1] * tex_height); 
     1046      glVertex3fv(&v[faces[i][2]][0]); 
     1047 
     1048      glTexCoord2f((1.0 - mapping[i][2]) * tex_width, 
     1049                   mapping[i][3] * tex_height); 
     1050      glVertex3fv(&v[faces[i][3]][0]); 
     1051      glEnd(); 
     1052      glEndList(); 
     1053    } 
     1054   
     1055} 
    10241056 
    10251057  void 
     
    10481080      } 
    10491081      glPolygonMode(GL_FRONT, GL_FILL); 
    1050       glBegin(GL_QUADS); 
    1051       //      glNormal3fv(&n[i][0]); 
    1052       glTexCoord2f((1.0 - mapping[i][4]) * tex_width, 
    1053                    mapping[i][5] * tex_height); 
    1054       glVertex3fv(&v[faces[i][0]][0]); 
    1055  
    1056       glTexCoord2f((1.0 - mapping[i][6]) * tex_width, 
    1057                    mapping[i][7] * tex_height); 
    1058       glVertex3fv(&v[faces[i][1]][0]); 
    1059  
    1060       glTexCoord2f((1.0 - mapping[i][0]) * tex_width, 
    1061                    mapping[i][1] * tex_height); 
    1062       glVertex3fv(&v[faces[i][2]][0]); 
    1063  
    1064       glTexCoord2f((1.0 - mapping[i][2]) * tex_width, 
    1065                    mapping[i][3] * tex_height); 
    1066       glVertex3fv(&v[faces[i][3]][0]); 
    1067  
    1068       glEnd(); 
     1082      glCallList(cube_faces+i); 
    10691083    } 
    10701084  }