Changeset 861 for trunk/vizservers


Ignore:
Timestamp:
Jan 29, 2008 2:15:22 PM (16 years ago)
Author:
kostmo
Message:

Added animation routine to FlowCmd?

Location:
trunk/vizservers/nanovis
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/vizservers/nanovis/Command.cpp

    r860 r861  
    5656// FOR testing new functions
    5757//#define  _LOCAL_ZINC_TEST_
    58 //#include "Test.h"
     58#include "Test.h"
    5959
    6060// EXTERN DECLARATIONS
     
    276276    }
    277277    */
     278
     279
     280/*
    278281    NanoVis::read_screen();
    279282    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
     
    284287   
    285288    NanoVis::resize_offscreen_buffer(old_win_width, old_win_height);
     289*/
     290   
    286291#endif
    287292
     
    11241129        return TCL_ERROR;
    11251130    }
     1131    return TCL_OK;
    11261132}
    11271133
     
    12601266    else if (c == 'c' && strcmp(argv[1],"capture") == 0)
    12611267    {
    1262                 int frame_count;
    1263         if (Tcl_GetInt(interp, argv[2], &frame_count) != TCL_OK)
     1268                int total_frame_count = 0;
     1269        if (Tcl_GetInt(interp, argv[2], &total_frame_count) != TCL_OK)
    12641270                {
    12651271                return TCL_ERROR;
     
    12691275        if (NanoVis::particleRenderer) NanoVis::particleRenderer->activate();
    12701276
    1271                 // Karl
    1272                 // pur your code ..
     1277        // Karl
     1278        {
     1279
     1280        for (int frame_count = 0; frame_count<total_frame_count; frame_count++) {
     1281
     1282                // Generate the latest frame and send it back to the client
     1283                if (NanoVis::licRenderer && NanoVis::licRenderer->isActivated())
     1284                      NanoVis::licRenderer->convolve();               
     1285
     1286                if (NanoVis::particleRenderer && NanoVis::particleRenderer->isActivated())
     1287                        NanoVis::particleRenderer->advect();
     1288
     1289                NanoVis::offscreen_buffer_capture();  //enable offscreen render
     1290                NanoVis::display();
     1291
     1292//              printf("Read Screen for Writing to file...\n");
     1293
     1294                NanoVis::read_screen();
     1295                glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
     1296
     1297                NanoVis::bmp_write_to_file(frame_count);
     1298//              printf("Writing to file...\n");
     1299        }
     1300
     1301
     1302        }// put your code...
    12731303
    12741304        if (NanoVis::licRenderer) NanoVis::licRenderer->deactivate();
     
    20562086    Tcl_CreateCommand(interp, "test", TestCmd,
    20572087        (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
     2088
     2089
     2090//    Tcl_CreateCommand(interp, "flow", FlowCmd,
     2091 //       (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
    20582092#endif
    20592093
     
    21282162
    21292163    //
     2164    // This is now in "FlowCmd()":
    21302165    //  Generate the latest frame and send it back to the client
    21312166    //
     2167    /*
    21322168    if (NanoVis::licRenderer && NanoVis::licRenderer->isActivated())
    21332169    {
     
    21392175        NanoVis::particleRenderer->advect();
    21402176    }
     2177    */
    21412178
    21422179    NanoVis::offscreen_buffer_capture();  //enable offscreen render
  • trunk/vizservers/nanovis/nanovis.cpp

    r860 r861  
    787787// FOR DEBUGGING
    788788void
    789 NanoVis::bmp_write_to_file()
     789NanoVis::bmp_write_to_file(int frame_number)
    790790{
    791791    unsigned char header[54];
     
    851851
    852852    FILE* f;
    853     f = fopen("/tmp/image.bmp", "wb");
     853    char filename[100];
     854    if (frame_number >= 0) {
     855        sprintf(filename, "/tmp/flow_animation/image%03d.bmp", frame_number);
     856        printf("Writing %s\n", filename);
     857        f = fopen(filename, "wb");
     858    }
     859    else {
     860        f = fopen("/tmp/image.bmp", "wb");
     861    }
    854862    fwrite((void*) header, sizeof(header), 1, f);
    855863    fwrite((void*) screen_buffer, (3*win_width+pad)*win_height, 1, f);
  • trunk/vizservers/nanovis/nanovis.h

    r860 r861  
    150150    static void offscreen_buffer_capture(void);
    151151    static void bmp_write(const char* cmd);
    152     static void bmp_write_to_file();
     152    static void bmp_write_to_file(int frame_number);
    153153    static void display(void);
    154154    static void display_offscreen_buffer();
Note: See TracChangeset for help on using the changeset viewer.