GLfloat qw = QW, qh = QH; /* for the quad we'll draw */
GLfloat qx = -6 , qy = 6;
int mono = 0, wire = 0, ticks = 0;
+GLuint screentexture;
typedef struct {
GLint WindH, WindW;
#define NUM_SCENES 2
/* draw method for ant */
-Bool draw_ant(float *Material, int mono, int shadow,
+Bool draw_ant(GLfloat *Material, int mono, int shadow,
float ant_step, Bool (*sphere)(float), Bool (*cone)(float)) {
float cos1 = cos(ant_step);
if(!shadow) {
glBegin(GL_POINTS);
- glColor3fv(mono ? MaterialGray6 : MaterialRed);
+ glColor3fv(mono ? MaterialGray6 : MaterialGray5);
glVertex3f(0.40, 0.70, 0.40);
glVertex3f(0.40, 0.70, -0.40);
glEnd();
if(!shadow) {
glBegin(GL_POINTS);
- if(mono)
- glColor3fv(MaterialGray8);
- else
- glColor3fv(MaterialMagenta);
+ glColor3fv(MaterialGray5);
glVertex3f(-0.20 + 0.05 * cos1, 0.25 + 0.1 * sin1, 0.45);
glVertex3f(-0.20 + 0.05 * cos2, 0.00 + 0.1 * sin2, 0.45);
glVertex3f(-0.20 + 0.05 * cos3, -0.25 + 0.1 * sin3, 0.45);
if((quadObj = gluNewQuadric()) == 0)
return False;
- gluQuadricDrawStyle(quadObj, (GLenum) GLU_SILHOUETTE);
+ gluQuadricDrawStyle(quadObj, (GLenum) GLU_LINE);
gluSphere(quadObj, radius, 16, 8);
gluDeleteQuadric(quadObj);
double centertex[2];
glEnable(GL_TEXTURE_2D);
+ glBindTexture(GL_TEXTURE_2D, screentexture);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialGray6);
/* draw mesh */
ant->goal[1] = 0.0;
ant->goal[2] = random()%((int)(boardsize+0.5)-2) - boardsize/2.0 + 1.0;
}
- while(distance(ant->position, ant->goal) < 1.0);
+ while(distance(ant->position, ant->goal) < 2.0);
}
/* construct our ant */
ant->direction = 0.0;
ant->velocity = 0.02;
ant->material = MaterialGray5;
+ ant->step = 0;
find_goal();
}
ant->position[0] += ant->velocity * cos(ant->direction);
ant->position[2] += ant->velocity * sin(-ant->direction);
ant->step += 10*ant->velocity;
+ while(ant->step > 2*Pi)
+ ant->step -= 2*Pi;
}
void reshape_antspotlight(ModeInfo * mi, int width, int height) {
if(MI_IS_WIREFRAME(modeinfo))
return;
- ximage = screen_to_ximage(modeinfo->xgwa.screen, modeinfo->window);
+ ximage = screen_to_ximage(modeinfo->xgwa.screen, modeinfo->window, NULL);
qw = QW; qh = QH;
tw = modeinfo->xgwa.width;
else
MI_CLEARWINDOW(mi);
+ glGenTextures(1, &screentexture);
+ glBindTexture(GL_TEXTURE_2D, screentexture);
get_snapshot(mi);
+
build_ant();
mono = MI_IS_MONO(mi);
wire = MI_IS_WIREFRAME(mi);
/* position camera */
/* follow focused ant */
- glTranslatef(0.0, 0.0, -10.0 - mag);
+ glTranslatef(0.0, 0.0, -6.0 - mag);
glRotatef(35.0, 1.0, 0.0, 0.0);
gltrackball_rotate(mp->trackball);
glTranslatef(-ant->position[0], ant->position[1], -ant->position[2]);