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 */
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;
}
//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);
//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;
}