X-Git-Url: http://pileus.org/git/?p=grits;a=blobdiff_plain;f=src%2Fradar.c;h=1b611ecc5fd738a354ba95fa16cf5402767860e3;hp=8881662aefb5fdd4e0ac74c4319432cbf2faa521;hb=cc88970c4a849c32ca7555e318092266529233c8;hpb=807100ae8d20f0a22ab3bcf72c88c0c4a03ec112 diff --git a/src/radar.c b/src/radar.c index 8881662..1b611ec 100644 --- a/src/radar.c +++ b/src/radar.c @@ -96,6 +96,7 @@ static void load_sweep(Sweep *sweep) glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data); g_free(data); gdk_window_invalidate_rect(drawing->window, &drawing->allocation, FALSE); + gdk_window_process_updates(drawing->window, FALSE); } /* Load the default sweep */ @@ -109,23 +110,20 @@ static gboolean configure(GtkWidget *da, GdkEventConfigure *event, gpointer user static gboolean expose(GtkWidget *da, GdkEventExpose *event, gpointer user_data) { - glPushMatrix(); - glMatrixMode(GL_MODELVIEW); - glTranslatef(0, 0, 100000); - - //g_message("radar:expose"); + g_message("radar:expose"); Sweep *sweep = cur_sweep; /* Draw the rays */ + + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); glBindTexture(GL_TEXTURE_2D, sweep_tex); glEnable(GL_TEXTURE_2D); - + glColor4f(1,1,1,1); glBegin(GL_QUAD_STRIP); - int _ri; // not really used, creates strange fragments.. - for (_ri = 0; _ri < sweep->h.nrays; _ri++) { + for (int ri = 0; ri <= sweep->h.nrays+1; ri++) { /* Do the first sweep twice to complete the last Quad */ - int ri = _ri % sweep->h.nrays; - Ray *ray = sweep->ray[ri]; + Ray *ray = sweep->ray[ri % sweep->h.nrays]; /* right and left looking out from radar */ double left = ((ray->h.azimuth - ((double)ray->h.beam_width/2.))*M_PI)/180.0; @@ -148,7 +146,7 @@ static gboolean expose(GtkWidget *da, GdkEventExpose *event, gpointer user_data) } //g_print("ri=%d, nr=%d, bw=%f\n", _ri, sweep->h.nrays, sweep->h.beam_width); glEnd(); - glPushMatrix(); + glPopMatrix(); /* Texture debug */ //glBegin(GL_QUADS); @@ -159,20 +157,21 @@ static gboolean expose(GtkWidget *da, GdkEventExpose *event, gpointer user_data) //glEnd(); /* Print the color table */ - glDisable(GL_TEXTURE_2D); - glPushMatrix(); - glLoadIdentity(); - glBegin(GL_QUADS); - int i; - for (i = 0; i < nred; i++) { - glColor4ub(red[i], green[i], blue[i], get_alpha(i)); - glVertex3f(-1., (float)((i ) - nred/2)/(nred/2), 2.); // bot left - glVertex3f(-1., (float)((i+1) - nred/2)/(nred/2), 2.); // top left - glVertex3f(-.9, (float)((i+1) - nred/2)/(nred/2), 2.); // top right - glVertex3f(-.9, (float)((i ) - nred/2)/(nred/2), 2.); // bot right - } - glEnd(); - glPopMatrix(); + //glDisable(GL_TEXTURE_2D); + //glMatrixMode(GL_MODELVIEW ); glPushMatrix(); glLoadIdentity(); + //glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); + //glBegin(GL_QUADS); + //int i; + //for (i = 0; i < nred; i++) { + // glColor4ub(red[i], green[i], blue[i], get_alpha(i)); + // glVertex3f(-1.0, (float)((i ) - nred/2)/(nred/2), 0.0); // bot left + // glVertex3f(-1.0, (float)((i+1) - nred/2)/(nred/2), 0.0); // top left + // glVertex3f(-0.9, (float)((i+1) - nred/2)/(nred/2), 0.0); // top right + // glVertex3f(-0.9, (float)((i ) - nred/2)/(nred/2), 0.0); // bot right + //} + //glEnd(); + //glMatrixMode(GL_PROJECTION); glPopMatrix(); + //glMatrixMode(GL_MODELVIEW ); glPopMatrix(); return FALSE; }