Changeset 1194 for trunk


Ignore:
Timestamp:
Oct 28, 2008 12:05:25 PM (16 years ago)
Author:
gah
Message:
 
Location:
trunk/packages/vizservers/nanovis
Files:
4 edited

Legend:

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

    r1188 r1194  
    675675        nBytes -= nRead;
    676676    }
     677    if (NanoVis::recfile != NULL) {
     678        fwrite(buf.bytes(), sizeof(char), buf.size(), NanoVis::recfile);
     679        fflush(NanoVis::recfile);
     680    }
    677681    {
    678682        Rappture::Outcome err;
  • trunk/packages/vizservers/nanovis/NvEventLog.cpp

    r1193 r1194  
    1 #include "NvEventLog.h"
    21#include "config.h"
    32#include <stdio.h>
     
    98#include <stdlib.h>
    109#include <string.h>
    11 
     10#include "NvEventLog.h"
     11#include "nanovis.h"
    1212
    1313
     
    2525    char* logName = NULL;
    2626    int logNameLen = 0;
    27     extern int debug_flag;
    2827
    2928    if (user == NULL) {
     
    3938    }
    4039
    41     if (!debug_flag) {
     40    if (!NanoVis::debug_flag) {
    4241        //open log and map stderr to log file
    4342        xinetd_log = fopen(logName, "w");
  • trunk/packages/vizservers/nanovis/nanovis.cpp

    r1193 r1194  
    104104int NanoVis::updir = Y_POS;
    105105NvCamera* NanoVis::cam = NULL;
    106 bool NanoVis::axis_on = true;
    107 int NanoVis::win_width = NPIX;                  //size of the render window
    108 int NanoVis::win_height = NPIX;                 //size of the render window
    109106int NanoVis::n_volumes = 0;
    110 unsigned char* NanoVis::screen_buffer = NULL;
     107vector<Volume*> NanoVis::volume;
    111108vector<HeightMap*> NanoVis::heightMap;
    112109VolumeRenderer* NanoVis::vol_renderer = 0;
     
    119116graphics::RenderContext* NanoVis::renderContext = 0;
    120117NvLIC* NanoVis::licRenderer = 0;
     118R2Fonts* NanoVis::fonts;
    121119
    122120FILE *NanoVis::stdin = NULL;
     
    127125bool NanoVis::particle_on = false;
    128126bool NanoVis::vector_on = false;
     127bool NanoVis::axis_on = true;
    129128bool NanoVis::config_pending = false;
     129bool NanoVis::debug_flag = false;
    130130
    131131Tcl_Interp *NanoVis::interp;
     
    136136NVISid NanoVis::final_color_tex = 0;
    137137NVISid NanoVis::final_depth_rb = 0;
    138 int render_window;              //the handle of the render window;
    139 
    140 // pointers to volumes, currently handle up to 10 volumes
    141 /*FIXME: Is the above comment true? Is there a 10 volume limit */
    142 vector<Volume*> NanoVis::volume;
    143 
    144 //if true nanovis renders volumes in 3D, if not renders 2D plane
     138int NanoVis::render_window = 0;       /* GLUT handle for the render window */
     139int NanoVis::win_width = NPIX;        /* Width of the render window */
     140int NanoVis::win_height = NPIX;       /* Height of the render window */
     141
     142unsigned char* NanoVis::screen_buffer = NULL;
     143
    145144/* FIXME: This variable is always true. */
    146145bool volume_mode = true;
    147146
     147#ifdef notdef
    148148// color table for built-in transfer function editor
    149149float color_table[256][4];
    150 
    151 int debug_flag = false;
     150#endif
    152151
    153152// in Command.cpp
     
    168167CGparameter m_passthru_scale_param, m_passthru_bias_param;
    169168
    170 R2Fonts* NanoVis::fonts;
    171169
    172170// Variables for mouse events
     
    411409    start = CVT2SECS(tv);
    412410
    413     if (debug_flag) {
    414         fprintf(NanoVis::logfile, "%s\n", Tcl_DStringValue(dsPtr));
     411    if (NanoVis::debug_flag) {
     412        fprintf(NanoVis::logfile, "(%s)\n", Tcl_DStringValue(dsPtr));
    415413    }
    416414    if (NanoVis::recfile != NULL) {
    417         fprintf(NanoVis::recfile, "%s\n", Tcl_DStringValue(dsPtr));
     415        fprintf(NanoVis::recfile, "%s", Tcl_DStringValue(dsPtr));
    418416        fflush(NanoVis::recfile);
    419417    }
     
    507505}
    508506
     507#ifdef notdef
    509508//Update the transfer function using local GUI in the non-server mode
    510509void
    511510update_tf_texture()
    512511{
    513     glutSetWindow(render_window);
     512    glutSetWindow(NanoVis::render_window);
    514513
    515514    //fprintf(stderr, "tf update\n");
     
    537536#endif
    538537}
     538#endif
    539539
    540540int
     
    12161216
    12171217/*----------------------------------------------------*/
    1218 static void
    1219 idle()
    1220 {
     1218void
     1219NanoVis::idle()
     1220{
     1221    if (debug_flag) {
     1222        fprintf(stderr, "in idle()\n");
     1223    }
    12211224    glutSetWindow(render_window);
    12221225
     
    12281231#endif
    12291232#ifdef XINETD
    1230     NanoVis::xinetd_listen();
     1233    xinetd_listen();
    12311234#else
    12321235    glutPostRedisplay();
    12331236#endif
     1237    if (debug_flag) {
     1238        fprintf(stderr, "leaving idle()\n");
     1239    }
    12341240}
    12351241
     
    12371243NanoVis::display_offscreen_buffer()
    12381244{
     1245    if (debug_flag) {
     1246        fprintf(stderr, "in display_offscreen_buffer\n");
     1247    }
    12391248    glEnable(GL_TEXTURE_2D);
    12401249    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
     
    12571266    }
    12581267    glEnd();
     1268    if (debug_flag) {
     1269        fprintf(stderr, "leaving display_offscreen_buffer\n");
     1270    }
    12591271}
    12601272
     
    16001612    double xMin, xMax, yMin, yMax, zMin, zMax, wMin, wMax;
    16011613
     1614    if (debug_flag) {
     1615        fprintf(stderr, "in SetVolumeRanges\n");
     1616    }
    16021617    xMin = yMin = zMin = wMin = DBL_MAX;
    16031618    xMax = yMax = zMax = wMax = -DBL_MAX;
     
    16511666    }
    16521667    Volume::update_pending = false;
     1668    if (debug_flag) {
     1669        fprintf(stderr, "leaving SetVolumeRanges\n");
     1670    }
    16531671}
    16541672
     
    16581676    double xMin, xMax, yMin, yMax, zMin, zMax, wMin, wMax;
    16591677
     1678    if (debug_flag) {
     1679        fprintf(stderr, "in SetHeightmapRanges\n");
     1680    }
    16601681    xMin = yMin = zMin = wMin = DBL_MAX;
    16611682    xMax = yMax = zMax = wMax = -DBL_MAX;
     
    17151736    }
    17161737    HeightMap::update_pending = false;
     1738    if (debug_flag) {
     1739        fprintf(stderr, "leaving SetHeightmapRanges\n");
     1740    }
    17171741}
    17181742
     
    17211745NanoVis::display()
    17221746{
     1747    if (debug_flag) {
     1748        fprintf(stderr, "in display\n");
     1749    }
    17231750    //assert(glGetError()==0);
    17241751    if (HeightMap::update_pending) {
     
    17281755        SetVolumeRanges();
    17291756    }
     1757    if (debug_flag) {
     1758        fprintf(stderr, "in display: glClear\n");
     1759    }
    17301760    //start final rendering
    17311761    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //clear screen
    17321762
    17331763    if (volume_mode) {
     1764        if (debug_flag) {
     1765           fprintf(stderr, "in display: volume_mode\n");
     1766        }
    17341767        //3D rendering mode
    17351768        glEnable(GL_TEXTURE_2D);
     
    17961829        //perf->disable();
    17971830
     1831        if (debug_flag) {
     1832           fprintf(stderr, "in display: render heightmap\n");
     1833        }
    17981834        for (unsigned int i = 0; i < heightMap.size(); ++i) {
    17991835            if (heightMap[i]->isVisible()) {
     
    18141850#endif
    18151851    perf->reset();
     1852    if (debug_flag) {
     1853        fprintf(stderr, "leaving display\n");
     1854    }
    18161855
    18171856}
     
    20082047init_service()
    20092048{
    2010     if (!debug_flag) {
     2049    if (!NanoVis::debug_flag) {
    20112050        //open log and map stderr to log file
    20122051        xinetd_log = fopen("/tmp/log.txt", "w");
     
    21092148        fcntl(0, F_SETFL, flags | O_NONBLOCK);
    21102149        npass++;
     2150        if (NanoVis::debug_flag) {
     2151           break;
     2152        }
    21112153    }
    21122154    fcntl(0, F_SETFL, flags);
     
    21952237    glutInitWindowSize(NanoVis::win_width, NanoVis::win_height);
    21962238    glutInitWindowPosition(10, 10);
     2239    NanoVis::render_window = glutCreateWindow("nanovis");
    21972240    glutDisplayFunc(NanoVis::display);
    2198     glutIdleFunc(idle);
     2241    glutIdleFunc(NanoVis::idle);
    21992242    glutReshapeFunc(NanoVis::resize_offscreen_buffer);
     2243
    22002244#ifndef XINETD
    22012245    glutMouseFunc(NanoVis::mouse);
     
    22032247    glutKeyboardFunc(NanoVis::keyboard);
    22042248#endif
    2205 
    2206     render_window = glutCreateWindow("nanovis");
    22072249
    22082250
     
    22412283        case 3:
    22422284        case 'd':
    2243             debug_flag = true;
     2285            NanoVis::debug_flag = true;
    22442286            break;
    22452287        case 0:
    22462288        case 'i':
    2247             fprintf(stderr, "opening infile %s\n", optarg);
    22482289            NanoVis::stdin = fopen(optarg, "r");
    22492290            if (NanoVis::stdin == NULL) {
     
    22542295        case 1:
    22552296        case 'l':
    2256             fprintf(stderr, "opening logfile %s\n", optarg);
    22572297            NanoVis::logfile = fopen(optarg, "w");
    22582298            if (NanoVis::logfile == NULL) {
     
    22662306            char buf[200];
    22672307
    2268             fprintf(stderr, "Recording commands to %s\n", optarg);
    22692308            Tcl_DStringInit(&ds);
    22702309            Tcl_DStringAppend(&ds, optarg, -1);
     
    23212360    NvInitEventLog();
    23222361#endif
    2323     //event loop
    23242362    glutMainLoop();
    23252363
  • trunk/packages/vizservers/nanovis/nanovis.h

    r1182 r1194  
    135135    static int win_width;       //size of the render window
    136136    static int win_height;      //size of the render window
    137  
     137    static int render_window;
    138138
     139    static bool debug_flag;
    139140    static bool lic_on;
    140141    static bool particle_on;
     
    159160    static void bmp_write_to_file(int frame_number, const char* directory_name);
    160161    static void display(void);
     162    static void idle(void);
    161163    static void update(void);
    162164    static void display_offscreen_buffer();
Note: See TracChangeset for help on using the changeset viewer.