glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glClearColor(0.8f, 0.8f, 1.0f, 0.0f);
- glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
/* Depth test */
glClearDepth(1.0);
glLoadIdentity();
double rad = atan(height/2*1000.0/dist); // 1px = 1000 meters
double deg = (rad*180)/M_PI;
- gluPerspective(deg*2, width/height, 0.1f, 1000000000.0f);
+ gluPerspective(deg*2, width/height, dist-20, dist+20);
/* Camera position? */
glMatrixMode(GL_MODELVIEW);
/* Draw the rays */
+ glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glBindTexture(GL_TEXTURE_2D, sweep_tex);
glEnable(GL_TEXTURE_2D);
/* (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 */
- 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();
+ //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;
}
glBindTexture(GL_TEXTURE_2D, layers[i].tex);
glBegin(GL_POLYGON);
- glTexCoord2f(0.0, 0.0); glVertex3f(500*1000*-1.0, 500*1000* 1.0, layers[i].z);
+ glTexCoord2f(0.0, 0.0); glVertex3f(500*1000*-1.0, 500*1000* 0.0, layers[i].z);
glTexCoord2f(0.0, 1.0); glVertex3f(500*1000*-1.0, 500*1000*-1.0, layers[i].z);
glTexCoord2f(1.0, 1.0); glVertex3f(500*1000* 1.0, 500*1000*-1.0, layers[i].z);
- glTexCoord2f(1.0, 0.0); glVertex3f(500*1000* 1.0, 500*1000* 1.0, layers[i].z);
+ glTexCoord2f(1.0, 0.0); glVertex3f(500*1000* 1.0, 500*1000* 0.0, layers[i].z);
glEnd();
}