Exemple #1
0
ENTRYPOINT void
draw_voronoi (ModeInfo *mi)
{
  voronoi_configuration *vp = &vps[MI_SCREEN(mi)];
  Display *dpy = MI_DISPLAY(mi);
  Window window = MI_WINDOW(mi);

  if (!vp->glx_context)
    return;

  glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(vp->glx_context));

  glShadeModel(GL_FLAT);
  glEnable(GL_POINT_SMOOTH);
/*  glEnable(GL_LINE_SMOOTH);*/
/*  glEnable(GL_POLYGON_SMOOTH);*/

  glEnable (GL_DEPTH_TEST);
  glDepthFunc (GL_LEQUAL);

  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

  mi->polygon_count = 0;
  draw_cells (mi);
  move_points (vp);
  prune_points (vp);
  state_change (mi);

  if (mi->fps_p) do_fps (mi);
  glFinish();

  glXSwapBuffers(dpy, window);
}
Exemple #2
0
void scanline_convert(struct matrix *polygons, screen s, color c, int i){
  /////////////////SCANLINE CONVERSION//////////////////
  ////Designate points TOP, BOTTOM, and MIDDLE////
  int order_indices = order(polygons,i,1);
  int T, M, B;

  T = order_indices/100;
  M = (order_indices%100)/10;
  B = order_indices%10;
  ////////////////////////////////////////////////
  //Check to see if everything is in order
  if(!(polygons->m[1][i+T] >= polygons->m[1][i+M] && polygons->m[1][i+M] >= polygons->m[1][i+B])){
    printf("   Top: (%f,%f)\n",polygons->m[0][i+T],polygons->m[1][i+T]);
    printf("Middle: (%f,%f)\n",polygons->m[0][i+M],polygons->m[1][i+M]);
    printf("Bottom: (%f,%f)\n\n",polygons->m[0][i+B],polygons->m[1][i+B]);
  }

  ///////////Set x0, y0, x1, y1, and d0////////////
  move_points(polygons,s,c,i,T,M,B);
}