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 */
/* Draw the rays */
+ glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glBindTexture(GL_TEXTURE_2D, sweep_tex);
glEnable(GL_TEXTURE_2D);
- glColor3f(1,1,1);
+ 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;
/* (find middle of bin) / scale for opengl */
// near left
glTexCoord2f(0.0, (double)ri/sweep->h.nrays);
- glVertex3f(lx*near_dist, ly*near_dist, 1.0);
+ glVertex3f(lx*near_dist, ly*near_dist, 2.0);
// far left
glTexCoord2f(1.0, (double)ri/sweep->h.nrays);
- glVertex3f(lx*far_dist, ly*far_dist, 1.0);
+ glVertex3f(lx*far_dist, ly*far_dist, 2.0);
}
//g_print("ri=%d, nr=%d, bw=%f\n", _ri, sweep->h.nrays, sweep->h.beam_width);
glEnd();
//glEnd();
/* Print the color table */
- glPushMatrix();
- glDisable(GL_TEXTURE_2D);
- glMatrixMode(GL_MODELVIEW ); glLoadIdentity();
- glMatrixMode(GL_PROJECTION); 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();
- 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;
}