Ignore:
Timestamp:
02/19/07 09:16:59 (17 years ago)
Author:
gumbau
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/vmi/src/main.cpp

    r2090 r2127  
    88 
    99Camera *cameras = NULL; 
    10 GLuint numCameras = 0; 
     10int numCameras = 0; 
    1111 
    1212Color *colors = NULL; 
    1313 
    14 GLuint **histogram = NULL, 
    15         *queries = NULL; 
     14int **histogram = NULL; 
     15GLuint *queries = NULL; 
    1616 
    1717Mesh *mesh = NULL; 
     
    2828          bRemoveRedundantVertices = GL_TRUE; 
    2929 
    30 GLuint cameraType = 0, 
     30int cameraType = 0, 
    3131       numDemandedTriangles = 0; 
    3232 
     
    174174} 
    175175 
     176void VMI::updateHWAcceleration(Change *c) { 
     177    
     178#ifdef VERTEX_ARRAY_INTERLEAVE 
     179    if (interleave != NULL) free(interleave); 
     180    interleave = setupInterleave(mesh, colors); 
     181#endif 
     182#ifdef VERTEX_ARRAY 
     183    updateVertexArray(mesh, c); 
     184#endif 
     185#ifdef VERTEX_BUFFER_OBJECTS 
     186    updateVertexBufferObjects(mesh, c); 
     187#endif 
     188 
     189} 
     190 
    176191void VMI::setOrthographicProjection(void) { 
    177192    // Switch to projection mode 
     
    208223void VMI::renderGeometry(void) { 
    209224#ifdef IMMEDIATE_MODE 
    210     GLuint i, v1, v2, v3; 
     225    int i, v1, v2, v3; 
    211226 
    212227    // Immediate mode 
     
    228243#else 
    229244#ifdef VERTEX_ARRAY 
    230     glDrawArrays(GL_TRIANGLES, 0, mesh->currentNumTriangles * 3); 
     245    glDrawArrays(GL_TRIANGLES, 0, mesh->numTriangles * 3); 
    231246#endif 
    232247#ifdef VERTEX_ARRAY_INTERLEAVE 
     
    235250#endif 
    236251#ifdef VERTEX_BUFFER_OBJECTS 
    237     glDrawArrays(GL_TRIANGLES, 0, mesh->currentNumTriangles * 3); 
     252    glDrawArrays(GL_TRIANGLES, 0, mesh->numTriangles * 3); 
    238253#endif 
    239254 
     
    264279    glutSwapBuffers(); 
    265280} 
    266 void VMI::renderScene(GLuint **histogram, GLuint numCameras) 
    267 { 
    268     GLuint i; 
     281 
     282void VMI::resetProjectedAreas(int **histogram, int numCameras) { 
     283    int i = 0; 
     284 
     285    // Reset the projected areas for all cameras 
     286    for (i=0; i<numCameras; i++) 
     287        resetSWHistogram(histogram[i], mesh->numTriangles); 
     288} 
     289 
     290void VMI::getProjectedAreas(int **histogram, int numCameras) 
     291{ 
     292    int i; 
    269293 
    270294    // draw to the frame buffer 
    271295    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb); 
    272          
    273     // Apply HW acceleration OpenGL Technique 
    274     applyHWAcceleration();  
    275  
    276     glDrawBuffer(GL_BACK); 
    277     glReadBuffer(GL_BACK); 
     296 
     297    //glDrawBuffer(GL_BACK); 
     298    //glReadBuffer(GL_BACK); 
    278299 
    279300    // Get the projected areas for all cameras 
     
    312333    /////////////////////////////////////////////////////////////////////////// 
    313334} 
    314 void VMI::renderSceneWin(GLuint **histogram, GLuint numCameras, Change *c) 
    315 { 
    316     GLuint i, j, t, background; 
     335void VMI::getProjectedAreasWin(int **histogram, int numCameras, Change *c) 
     336{ 
     337    int i, j, t, background; 
    317338    int del_area, mod_area; 
    318339    GLfloat min[3], max[3]; 
     
    325346    //printf("\n(%f,%f,%f)-(%f,%f,%f)\n", min[0], min[1], min[2], max[0], max[1], max[2]); 
    326347     
    327     // Apply HW acceleration OpenGL Technique 
    328     applyHWAcceleration();  
    329  
    330     glDrawBuffer(GL_BACK); 
    331     glReadBuffer(GL_BACK); 
     348    // Update HW acceleration OpenGL Technique 
     349    updateHWAcceleration(c); 
     350 
     351    //glDrawBuffer(GL_BACK); 
     352    //glReadBuffer(GL_BACK); 
    332353 
    333354    // Get the projected areas for all cameras 
     
    355376        mod_area = 0; 
    356377 
    357         for (j=0; j<( GLuint)c->numDel; j++) { 
     378        for (j=0; j<c->numDel; j++) { 
    358379            t = c->deleted[j].id; 
    359380            del_area += histogram[i][t + 1]; 
     
    362383        } 
    363384 
    364         for (j=0; j<( GLuint)c->numMod; j++) { 
     385        for (j=0; j<c->numMod; j++) { 
    365386            t = c->modified[j].id; 
    366387            del_area += histogram[i][t + 1]; 
     
    371392        getSWHistogramWin(histogram[i], pixels, min, max, c);  
    372393 
    373         for (j=0; j<( GLuint)c->numMod; j++) { 
     394        for (j=0; j<c->numMod; j++) { 
    374395            t = c->modified[j].id; 
    375396            mod_area += histogram[i][t + 1]; 
     
    425446     
    426447    glDeleteBuffersARB(1, &color_buf); 
     448 
     449    //free(pbuf_vertices); 
     450    //free(pbuf_colors); 
     451 
     452                buf_vertices = NULL; 
     453    buf_colors = NULL; 
     454 
     455#endif 
     456#ifdef VERTEX_ARRAY 
     457    //free(pbuf_vertices); 
     458    //free(pbuf_colors); 
     459 
     460                buf_vertices = NULL; 
     461    buf_colors = NULL; 
    427462#endif 
    428463 
     
    457492 
    458493        start = clock(); 
     494 
     495        // Apply HW acceleration OpenGL Technique 
     496  applyHWAcceleration(); 
    459497 
    460498        getProjectedAreas(histogram, numCameras); 
Note: See TracChangeset for help on using the changeset viewer.