示例#1
0
void Scene::draw() {
    GLfloat m[4][4];
    recalcModelView();
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    if (showAxis) {
        drawRotationAxis();
    }
    
    if (modelsMode) {        
        glScalef(6, 6, 6);        
        for (unsigned i=0; i < models.size(); i++) {
            models[i]->render();
        }
    } else {
        if (game) {
            drawObject(vertexes, exluded);
            drawExcluded();
        } else {
            drawObject(vertexes, -1);
        }

        if (skeleton) {
            drawSkeleton();
        }
    }
      
    glutSwapBuffers();
}
示例#2
0
void
redraw(void)
{
  if (newModel)
    recalcModelView();
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  glCallList(DINOSAUR);
  glutSwapBuffers();
}
示例#3
0
void
redraw(void)
{
  if (newModel)
    recalcModelView();
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  glCallList(DINOSAUR);
  showMessage(2, 7.1, 4.1, "Spin me.");
  glutSwapBuffers();
}
示例#4
0
void
redraw(void)
{
  int i;

  glDepthMask(GL_TRUE);
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  if (newModel)
    recalcModelView();

  /* Draw the floor. */
  if (useTexture) {
    glEnable(GL_TEXTURE_2D);
  }
  glColor3f(0.5, 1.0, 0.5);
  glBegin(GL_QUADS);
    glTexCoord2f(0.0, 0.0);
    glVertex3f(-EDGE, -0.05, -EDGE);
    glTexCoord2f(20.0, 0.0);
    glVertex3f(EDGE, -0.05, -EDGE);
    glTexCoord2f(20.0, 20.0);
    glVertex3f(EDGE, -0.05, EDGE);
    glTexCoord2f(0.0, 20.0);
    glVertex3f(-EDGE, -0.05, EDGE);
  glEnd();

  /* Allow particles to blend with each other. */
  glDepthMask(GL_FALSE);

  if (useTexture) {
    glDisable(GL_TEXTURE_2D);
  }
  glBegin(GL_POINTS);
    for (i=0; i<numPoints; i++) {
      /* Draw alive particles. */
      if (colorList[i] != DEAD) {
        glColor4fv(colorSet[colorList[i]]);
        glVertex3fv(pointList[i]);
      }
    }
  glEnd();

  glutSwapBuffers();
}
示例#5
0
文件: trip.c 项目: gwowen/seismicunix
void
redraw(void)
{
	int iplane;
	if (glb_newModel) recalcModelView();
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	for (iplane=0;iplane<3;iplane++) {
		if (glb_plane_flag[iplane]==ON)
			glCallList(iplane+3);
	}
	if (glb_plot_axis==PLOT_AXIS) {
		glCallList(6);
		showMessage(RADIUS, 0, 0, "x");
		showMessage(0, RADIUS, 0, "y");
		showMessage(0, 0,-RADIUS, "z");
	}
	glFlush();
	glutSwapBuffers();
}
示例#6
0
/***************************************************
Called whenever glutPostRedisplay() is called
***************************************************/
void
redraw(void)
{
      int ihz;
      if (glb_newmodel) recalcModelView();
      glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

      for (ihz=0;ihz<nhz;ihz++) {
	    if (hlt==LAYER && glb_on_or_off[ihz]==ON)
		  glCallList(ihz+3);
	    else if (hlt==HORZ && glb_on_or_off[ihz]==ON)
		  glCallList(nhz+ihz+3);
	    else if (hlt==TETRA && glb_on_or_off[ihz]==ON)
		  glCallList(ihz+2*nhz+3);
	    else if (hlt==TRI && glb_on_or_off[ihz]==ON)
		  glCallList(ihz+3*nhz+3);
      }

      if (glb_plot_rays==PLOT_RAYS) {
	    if (wc_rays==WHITE)
	          glCallList(nhz*4+3);
	    else
	          glCallList(nhz*4+4);
      }

      if (plot_st==PLOT_SURFACE_TRAVELTIMES)
            glCallList(nhz*4+5);

      if (glb_plot_wf==PLOT_WF) {
	    if (wfs==WIRED)
                  glCallList(nhz*4+6);
	    else
	          glCallList(nhz*4+7);
      }

      glFlush();
      /*showMessage(0, 0, 0, "x direction");*/
      glutSwapBuffers();
}
示例#7
0
void mainDisplay(void)
{
    int      c;

    if(newModel) {
        recalcModelView();
    }
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    /* draw the bounding box */
    glLineWidth(1.0);
    glColor4f(0.0, 1.0, 0.0, 0.3);

    glBegin(GL_LINE_STRIP);
    glVertex3f(min[0], min[1], min[2]);
    glVertex3f(min[0], max[1], min[2]);
    glVertex3f(max[0], max[1], min[2]);
    glVertex3f(max[0], min[1], min[2]);
    glVertex3f(min[0], min[1], min[2]);

    glVertex3f(min[0], min[1], max[2]);
    glVertex3f(min[0], max[1], max[2]);
    glVertex3f(max[0], max[1], max[2]);
    glVertex3f(max[0], min[1], max[2]);
    glVertex3f(min[0], min[1], max[2]);
    glEnd();

    glBegin(GL_LINES);
    glVertex3f(max[0], min[1], min[2]);
    glVertex3f(max[0], min[1], max[2]);

    glVertex3f(max[0], max[1], min[2]);
    glVertex3f(max[0], max[1], max[2]);

    glVertex3f(min[0], max[1], min[2]);
    glVertex3f(min[0], max[1], max[2]);
    glEnd();

    /* Draw the points if wanted */
    if(points) {
        glPointSize(2.0);
        glColor4f(0.8, 0.0, 0.9, 0.9);
        glBegin(GL_POINTS);
        for(c = 0; c < n_coords; c++) {
            glVertex3f(x_coord[c], y_coord[c], z_coord[c]);
        }
        glEnd();
    }

    /* Draw the lines if wanted */
    if(lines) {
        glLineWidth(0.1);
        glColor4f(0.0, 0.5, 0.9, 0.4);

        glBegin(GL_LINE_STRIP);
        for(c = 0; c < n_coords; c++) {
            glVertex3f(x_coord[c], y_coord[c], z_coord[c]);
        }
        glEnd();
    }

    glFlush();
    glutSwapBuffers();
}
示例#8
0
void
redraw(void)
{
  if (newModel)
    recalcModelView();

  glClear(GL_COLOR_BUFFER_BIT | 
          GL_DEPTH_BUFFER_BIT | 
          GL_STENCIL_BUFFER_BIT);

  /* Draw the real scene in the left viewport... */
  glViewport(0, 0, W / 2, H);

  glDisable(GL_STENCIL_TEST);
  glCallList(DINOSAUR);
  showMessage(2, 7.1, 4.1, "Spin me.");

  /* ...and the overdraw indicator in the right viewport */
  glViewport(W / 2, 0, W / 2, H);

  /* First draw the scene again, this time without color updates,
   * just counting pixels drawn in the stencil buffer.
   */
  glEnable(GL_STENCIL_TEST);
  glStencilFunc(GL_ALWAYS, 0, 0);
  glStencilOp(GL_KEEP, GL_INCR, GL_INCR);
  glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
  glCallList(DINOSAUR);
  showMessage(2, 7.1, 4.1, "Spin me.");

  glMatrixMode(GL_MODELVIEW);
  glPushMatrix();
  glLoadIdentity();
  glMatrixMode(GL_PROJECTION);
  glPushMatrix();
  glLoadIdentity();
  glDisable(GL_LIGHTING);
  glDisable(GL_DEPTH_TEST);

  glColor3f(1.0f, 1.0f, 1.0f);
  glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);

  /* Copy bit 0 into the blue plane */
  glColorMask(GL_FALSE, GL_FALSE, GL_TRUE, GL_FALSE);
  glStencilFunc(GL_NOTEQUAL, 0, 0xf8 | 0x01);
  glRectf(-1.0f, -1.0f, 1.0f, 1.0f);

  /* Copy bit 1 into the red plane */
  glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_FALSE);
  glStencilFunc(GL_NOTEQUAL, 0, 0xf8 | 0x02);
  glRectf(-1.0f, -1.0f, 1.0f, 1.0f);

  /* Copy bit 2 into the green plane */
  glColorMask(GL_FALSE, GL_TRUE, GL_FALSE, GL_FALSE);
  glStencilFunc(GL_NOTEQUAL, 0, 0xf8 | 0x04);
  glRectf(-1.0f, -1.0f, 1.0f, 1.0f);

  /* Note that anything greater than 7 will have one of  bits 3-7 set,
   * hence will be drawn on all three planes by the mask with 0xf8 above.
   * So anything overdrawn 7 or more times will be drawn in white.
   */

  glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
  glEnable(GL_DEPTH_TEST);
  glEnable(GL_LIGHTING);
  glMatrixMode(GL_PROJECTION);
  glPopMatrix();
  glMatrixMode(GL_MODELVIEW);
  glPopMatrix();

  glutSwapBuffers();
}