示例#1
0
文件: click.c 项目: seth4618/bbsim
Block *
click(int x, int y, int *face)
{
	GLuint  buffer[BUFFER_SIZE];
	GLint	viewport[4];
	GLint  hits;

	glGetIntegerv(GL_VIEWPORT, viewport);
	glSelectBuffer(BUFFER_SIZE, buffer);

	glRenderMode(GL_SELECT);

	glMatrixMode(GL_PROJECTION);
	glPushMatrix();
	glLoadIdentity();

	gluPickMatrix((GLdouble) x, (GLdouble) (viewport[3]-y), 1.0f, 1.0f, viewport);

	gluPerspective(FOV, (GLfloat) (WINDOW_WIDTH/WINDOW_HEIGHT), Z_NEAR, Z_FAR);
	glMatrixMode(GL_MODELVIEW);
	redraw_world();
	glMatrixMode(GL_PROJECTION);
	glPopMatrix();

	glMatrixMode(GL_MODELVIEW);
	hits=glRenderMode(GL_RENDER);

	return processHits(hits, buffer, face);
}
示例#2
0
文件: wclock.c 项目: UIKit0/picogui
static void
redraw_all(void)
{
  ENTER("redraw_all()");
  int must_update = 0;

  if(zone_to_refresh!=-1) {
    gmt_h = -1; /* force redraw time bar */
    update_info(zone_to_refresh);
    must_update |= redraw_world(zone_to_refresh);
    must_update |= update_time(zone_to_refresh);
    current_zone = zone_to_refresh;
    zone_to_refresh = -1;
  }
  else {
    must_update |= update_time(current_zone);
  }

  if(must_update) {
    update();
  }
  
  LEAVE;
}