|
From: <th...@as...> - 2000-08-07 18:50:44
|
Hi,
I'm trying to use the vis5d api with my own gui interface and seemed
to be completely misunderstanding something. The following, very
short, program is supposed to just open a v5d gridfile and display
a box and map for 30 seconds and then quit. It does everything
successful except I cannot see anything. I've been digging through
the api manual and the vis5d source and cannot figure out what
I'm missing. Any ideas?
Bill
----------------------------------------------------------------------------
#include <stdio.h>
#include <tk.h>
#include "v5d.h"
#include "api.h"
int main (int argc, char **argv)
{
int ret;
int c,d;
char filename[128];
if (argc != 2) {
fprintf(stderr,"Usage: %s <vis5d file>\n",argv[0]);
exit(1);
} else {
strcpy(filename,*(argv+1));
printf("Opening \"%s\"\n",filename);
}
/* Initialize Vis5d */
vis5d_initialize(0); /* Done once */
vis5d_workers(0); /* All work done in foreground */
vis5d_init_path("/usr/local/vis5d-5.2"); /* Location of MAP and TOPO */
vis5d_init_window("My Test",500, 100, 600, 600);
c = vis5d_alloc_data_context();
d = vis5d_alloc_display_context();
vis5d_init_begin(c, d);
vis5d_init_memory( c, 0 );
if (vis5d_open_gridfile( c,filename , 0 )<0) {
vis5d_terminate(1);
exit(0);
}
vis5d_init_display_values(c, -1, d);
if (vis5d_init_data_end( c )<0) {
printf("Error in vis5d_init_data_end\n");
vis5d_terminate(1);
exit(0);
}
vis5d_graphics_mode (d, VIS5D_BOX, VIS5D_ON); /* Turn on box */
vis5d_graphics_mode (d, VIS5D_MAP, VIS5D_ON); /* Turn on map */
vis5d_enable_sfc_map(d, VIS5D_ON);
ret=vis5d_draw_frame(d,0); fprintf(stderr," draw_frame returned=%d\n",ret);
ret=vis5d_swap_frame(d); fprintf(stderr," swap_frame returned=%d\n",ret);
sleep(30); /* Sleep 30 seconds */
vis5d_terminate(0);
exit(0);
}
|