Пример #1
0
static void initializeGL(ModeInfo *mi, GLsizei width, GLsizei height) 
{
  pulsarstruct *gp = &Pulsar[MI_SCREEN(mi)];
  GLfloat fogColor[4] = { 0.1, 0.1, 0.1, 0.1 };

  glViewport( 0, 0, width, height ); 
  resetProjection();

  if (do_depth)
	glEnable(GL_DEPTH_TEST);

  if (do_antialias) {
	do_blend = 1;
	glEnable(GL_LINE_SMOOTH);
  }

  if (do_blend) {
	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
  }


  if (do_light) {
	glShadeModel(GL_SMOOTH);
	glEnable(GL_COLOR_MATERIAL);
	glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
  }

# ifdef HAVE_JWZGLES /* #### glPolygonMode other than GL_FILL unimplemented */
  do_wire = 0;
# endif

  if (do_wire)
	glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
  else 
	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);

  if (do_fog) {
	glEnable(GL_FOG);
	glFogi(GL_FOG_MODE, GL_LINEAR);
	glFogfv(GL_FOG_COLOR, fogColor);
	glFogf(GL_FOG_DENSITY, 0.35);
/*    	glHint(GL_FOG_HINT, GL_FASTEST); */
	glFogf(GL_FOG_START, 50.0);
	glFogf(GL_FOG_END, 100.0);
  }
	

  if (do_texture)
	  Create_Texture(mi, which_image); 

  GenerateQuad(gp);
}
Пример #2
0
static GLvoid drawScene(ModeInfo * mi) 
{
  pulsarstruct *gp = &Pulsar[MI_SCREEN(mi)];
/*  check_gl_error ("drawScene"); */
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

  /* we have to do this here because the FPS meter turns these 3 features off!! */
  {
	if (do_light) {
	  glEnable(GL_LIGHTING);
	  glEnable(GL_LIGHT0);
	}
	
	if (do_texture) {
	  glEnable(GL_TEXTURE_2D);
	}
	
	if (do_blend) {
	  glEnable(GL_BLEND);
	  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	}
  }

  resetProjection();

  /* use XYZ scaling factors to change the size of the pulsar */
  glScalef(gp->scale_x, gp->scale_y, gp->scale_z);
  drawQuads(gp);
  mi->polygon_count = num_quads;

  /* update the scaling factors- cyclic */
  gp->scale_x = cos(gp->frame/360.)*10.;
  gp->scale_y = sin(gp->frame/360.)*10.;
  gp->scale_z = 1;

  /* increment frame-counter */
  gp->frame++;

/*  check_gl_error ("drawScene"); */
}
Пример #3
0
/* Standard reshape function */
ENTRYPOINT void
reshape_gflux(ModeInfo *mi, int width, int height)
{
    glViewport( 0, 0, width, height );
    resetProjection();
}
Пример #4
0
/* Standard reshape function */
ENTRYPOINT void
reshape_pulsar(ModeInfo *mi, int width, int height)
{
  glViewport( 0, 0, MI_WIDTH(mi), MI_HEIGHT(mi) );
  resetProjection();
}