コード例 #1
0
ファイル: Evaluators.c プロジェクト: xpika/winhugs
static void hugsprim_glMapGrid2d_18(HugsStackPtr hugs_root)
{
    HsInt32 arg1;
    HsDouble arg2;
    HsDouble arg3;
    HsInt32 arg4;
    HsDouble arg5;
    HsDouble arg6;
    arg1 = hugs->getInt32();
    arg2 = hugs->getDouble();
    arg3 = hugs->getDouble();
    arg4 = hugs->getInt32();
    arg5 = hugs->getDouble();
    arg6 = hugs->getDouble();
    glMapGrid2d(arg1, arg2, arg3, arg4, arg5, arg6);
    
    hugs->returnIO(hugs_root,0);
}
コード例 #2
0
ファイル: g_render.c プロジェクト: aosm/X11
void __glXDisp_MapGrid2d(GLbyte *pc)
{

#ifdef __GLX_ALIGN64
	if ((unsigned long)(pc) & 7) {
	    __GLX_MEM_COPY(pc-4, pc, 40);
	    pc -= 4;
	}
#endif
	glMapGrid2d( 
		*(GLint    *)(pc + 32),
		*(GLdouble *)(pc + 0),
		*(GLdouble *)(pc + 8),
		*(GLint    *)(pc + 36),
		*(GLdouble *)(pc + 16),
		*(GLdouble *)(pc + 24)
	);
}
コード例 #3
0
ファイル: evaltest.c プロジェクト: peterjakowetz/proj_1
static void
RenderEval(void)
{

  if (colorType) {
    glEnable(GL_MAP1_COLOR_4);
    glEnable(GL_MAP2_COLOR_4);
  } else {
    glDisable(GL_MAP1_COLOR_4);
    glDisable(GL_MAP2_COLOR_4);
  }

  if (textureType) {
    glEnable(GL_TEXTURE_2D);
    glEnable(GL_MAP2_TEXTURE_COORD_2);
  } else {
    glDisable(GL_TEXTURE_2D);
    glDisable(GL_MAP2_TEXTURE_COORD_2);
  }

  if (polygonFilled) {
    glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
  } else {
    glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
  }

  glShadeModel(GL_SMOOTH);

  switch (mapType) {
  case EVAL:
    switch (arrayType) {
    case ONE_D:
      glDisable(GL_MAP2_VERTEX_4);
      glEnable(GL_MAP1_VERTEX_4);
      DrawPoints1();
      DrawMapEval1(0.1 / VORDER);
      break;
    case TWO_D:
      glDisable(GL_MAP1_VERTEX_4);
      glEnable(GL_MAP2_VERTEX_4);
      DrawPoints2();
      DrawMapEval2(0.1 / VMAJOR_ORDER, 0.1 / VMINOR_ORDER);
      break;
    }
    break;
  case MESH:
    switch (arrayType) {
    case ONE_D:
      DrawPoints1();
      glDisable(GL_MAP2_VERTEX_4);
      glEnable(GL_MAP1_VERTEX_4);
      glColor3f(0.0, 0.0, 1.0);
      glMapGrid1d(40, 0.0, 1.0);
      if (mapPoint) {
        glPointSize(2);
        glEvalMesh1(GL_POINT, 0, 40);
      } else {
        glEvalMesh1(GL_LINE, 0, 40);
      }
      break;
    case TWO_D:
      DrawPoints2();
      glDisable(GL_MAP1_VERTEX_4);
      glEnable(GL_MAP2_VERTEX_4);
      glColor3f(0.0, 0.0, 1.0);
      glMapGrid2d(20, 0.0, 1.0, 20, 0.0, 1.0);
      if (mapPoint) {
        glPointSize(2);
        glEvalMesh2(GL_POINT, 0, 20, 0, 20);
      } else if (polygonFilled) {
        glEvalMesh2(GL_FILL, 0, 20, 0, 20);
      } else {
        glEvalMesh2(GL_LINE, 0, 20, 0, 20);
      }
      break;
    }
    break;
  }
}
コード例 #4
0
ファイル: GEMglMapGrid2d.cpp プロジェクト: avilleret/Gem
/////////////////////////////////////////////////////////
// Render
//
void GEMglMapGrid2d :: render(GemState *state) {
	glMapGrid2d (un, u1, u2, vn, v1, v2);
}
コード例 #5
0
ファイル: evaltest.c プロジェクト: linghushaoxia/glut
static void
RenderEval(void)
{

  if (colorType) {
    glEnable(GL_MAP1_COLOR_4);
    glEnable(GL_MAP2_COLOR_4);
  } else {
    glDisable(GL_MAP1_COLOR_4);
    glDisable(GL_MAP2_COLOR_4);
  }

  if (textureType) {
    glEnable(GL_TEXTURE_2D);
    glEnable(GL_MAP2_TEXTURE_COORD_2);
  } else {
    glDisable(GL_TEXTURE_2D);
    glDisable(GL_MAP2_TEXTURE_COORD_2);
  }

  if (polygonFilled) {
    glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
  } else {
    glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
  }

  glShadeModel(GL_SMOOTH);

  switch (mapType) {
  case EVAL:
    switch (arrayType) {
    case ONE_D:
      glDisable(GL_MAP2_VERTEX_4);
      glEnable(GL_MAP1_VERTEX_4);
      DrawPoints1();
      DrawMapEval1(0.1 / VORDER);
      break;
    case TWO_D:
      glDisable(GL_MAP1_VERTEX_4);
      glEnable(GL_MAP2_VERTEX_4);
      DrawPoints2();
      DrawMapEval2(0.1 / VMAJOR_ORDER, 0.1 / VMINOR_ORDER);
      break;
    }
    break;
  case MESH:
    switch (arrayType) {
    case ONE_D:
      DrawPoints1();
      glDisable(GL_MAP2_VERTEX_4);
      glEnable(GL_MAP1_VERTEX_4);
      glColor3f(0.0, 0.0, 1.0);
      glMapGrid1d(40, 0.0, 1.0);
      if (mapPoint) {
        glPointSize(2);
        glEvalMesh1(GL_POINT, 0, 40);
      } else {
        glEvalMesh1(GL_LINE, 0, 40);
      }
      break;
    case TWO_D:
      DrawPoints2();
      glDisable(GL_MAP1_VERTEX_4);
      glEnable(GL_MAP2_VERTEX_4);
      glColor3f(0.0, 0.0, 1.0);
      glMapGrid2d(20, 0.0, 1.0, 20, 0.0, 1.0);
      if (mapPoint) {
        glPointSize(2);
        glEvalMesh2(GL_POINT, 0, 20, 0, 20);
      } else if (polygonFilled) {
        glEvalMesh2(GL_FILL, 0, 20, 0, 20);
      } else {
        glEvalMesh2(GL_LINE, 0, 20, 0, 20);
      }
      break;
    default:;
      /* Mesa makes GLenum be a C "enum" and gcc will warn if
         all the cases of an enum are not tested in a switch
         statement.  Add default case to supress the error. */
    }
    break;
  }
}
コード例 #6
0
ファイル: freeglut_teapot.c プロジェクト: MacTop/omegalib
static void fghTeapot( GLint grid, GLdouble scale, GLenum type )
{
#if defined(_WIN32_WCE)
		int i, numV=sizeof(strip_vertices)/4, numI=sizeof(strip_normals)/4;
#else
    double p[4][4][3], q[4][4][3], r[4][4][3], s[4][4][3];
    long i, j, k, l;
#endif

    glPushAttrib( GL_ENABLE_BIT | GL_EVAL_BIT );
    glEnable( GL_AUTO_NORMAL );
    glEnable( GL_NORMALIZE );
    glEnable( GL_MAP2_VERTEX_3 );
    glEnable( GL_MAP2_TEXTURE_COORD_2 );

    glPushMatrix();
    glRotated( 270.0, 1.0, 0.0, 0.0 );
    glScaled( 0.5 * scale, 0.5 * scale, 0.5 * scale );
    glTranslated( 0.0, 0.0, -1.5 );

#if defined(_WIN32_WCE)
    glRotated( 90.0, 1.0, 0.0, 0.0 );
    glBegin( GL_TRIANGLE_STRIP );

    for( i = 0; i < numV-1; i++ )
    {
        int vidx = strip_vertices[i],
            nidx = strip_normals[i];

        if( vidx != -1 )
        {
            glNormal3fv( normals[nidx]  );
            glVertex3fv( vertices[vidx] );
        }
        else
        {
            glEnd();
            glBegin( GL_TRIANGLE_STRIP );
        }
    }

    glEnd();
#else
    for (i = 0; i < 10; i++) {
      for (j = 0; j < 4; j++) {
        for (k = 0; k < 4; k++) {
          for (l = 0; l < 3; l++) {
            p[j][k][l] = cpdata[patchdata[i][j * 4 + k]][l];
            q[j][k][l] = cpdata[patchdata[i][j * 4 + (3 - k)]][l];
            if (l == 1)
              q[j][k][l] *= -1.0;
            if (i < 6) {
              r[j][k][l] =
                cpdata[patchdata[i][j * 4 + (3 - k)]][l];
              if (l == 0)
                r[j][k][l] *= -1.0;
              s[j][k][l] = cpdata[patchdata[i][j * 4 + k]][l];
              if (l == 0)
                s[j][k][l] *= -1.0;
              if (l == 1)
                s[j][k][l] *= -1.0;
            }
          }
        }
      }

      glMap2d(GL_MAP2_TEXTURE_COORD_2, 0.0, 1.0, 2, 2, 0.0, 1.0, 4, 2,
        &tex[0][0][0]);
      glMap2d(GL_MAP2_VERTEX_3, 0.0, 1.0, 3, 4, 0.0, 1.0, 12, 4,
        &p[0][0][0]);
      glMapGrid2d(grid, 0.0, 1.0, grid, 0.0, 1.0);
      glEvalMesh2(type, 0, grid, 0, grid);
      glMap2d(GL_MAP2_VERTEX_3, 0.0, 1.0, 3, 4, 0.0, 1.0, 12, 4,
        &q[0][0][0]);
      glEvalMesh2(type, 0, grid, 0, grid);
      if (i < 6) {
        glMap2d(GL_MAP2_VERTEX_3, 0.0, 1.0, 3, 4, 0.0, 1.0, 12, 4,
          &r[0][0][0]);
        glEvalMesh2(type, 0, grid, 0, grid);
        glMap2d(GL_MAP2_VERTEX_3, 0.0, 1.0, 3, 4, 0.0, 1.0, 12, 4,
          &s[0][0][0]);
        glEvalMesh2(type, 0, grid, 0, grid);
      }
    }
#endif  /* defined(_WIN32_WCE) */

    glPopMatrix();
    glPopAttrib();
}
コード例 #7
0
ファイル: gl.cpp プロジェクト: dschaefer/swt-opengl
M(void, glMapGrid2d, jint un, jdouble u1, jdouble u2, jint vn, jdouble v1, jdouble v2) {
	glMapGrid2d(un, u1, u2, vn, v1, v2);
}
コード例 #8
0
ファイル: Primitive.cpp プロジェクト: vitormota/LAIG_TP03
    void Patch::draw() {
        
        // permissao de atribuicao directa de cores
        // para objectos que nao tem material atribuido, como
        // e' o caso dos eixos e da esfera que simboliza a fonte de luz...
        //glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
        glEnable(GL_COLOR_MATERIAL);
        
        // INICIALIZACOES RELACIONADAS COM OS "EVALUATORS"
        
        // declaram-se quatro interpoladores, de coordenadas, de
        //     normais, de cores e de texturas:
        // o parâmetro de controlo dos interpoladors varia de 0 a 1,
        //     tanto em U como em V
        // os strides (ordem de visita no array de dados final) são:
        //     3 e 6 para o interpol. de coord. (respectivamente U e V)
        //     3 e 6 para o interpol. de normais (respectivamente U e V)
        //     4 e 8 para o interpolador de cores (respectivamente U e V)
        //     2 e 4 para o interpolador de texturas (respectivamente U e V)
        // a interpolação é linear (de grau 1) pelo que se coloca o
        //     valor "2" (grau + 1) nos quatro casos
        
        glColor3f(1.0,1.0,1.0);
        
        if(order == 1)
        {
            glMap2f(GL_MAP2_VERTEX_3, 0.0, 1.0, 3, this->order, 0.0, 1.0, 3*(this->order), this->order, &(this->vecControlPointsOrder1[0][0]));
           
            // so' para referencia visual... onde estao os quatro pontos
            // de controlo:
            glDisable(GL_TEXTURE_2D);
            glColor3f(1.0, 1.0, 0.0);
            for (int i = 0; i < 4; i++)
            {
                glRasterPos3f(this->vecControlPointsOrder1[i][0],this->vecControlPointsOrder1[i][1],this->vecControlPointsOrder1[i][2]);
                glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, '0'+i);
            }
        }
        else
            if(order == 2)
            {
                glMap2f(GL_MAP2_VERTEX_3, 0.0, 1.0, 3, this->order, 0.0, 1.0, 3*(this->order), this->order, &(this->vecControlPointsOrder2[0][0]));
                
                // so' para referencia visual... onde estao os quatro pontos
                // de controlo:
                glDisable(GL_TEXTURE_2D);
                glColor3f(1.0, 1.0, 0.0);
                for (int i = 0; i < 4; i++)
                {
                    glRasterPos3f(this->vecControlPointsOrder2[i][0],this->vecControlPointsOrder2[i][1],this->vecControlPointsOrder2[i][2]);
                    glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, '0'+i);
                }

            }
            else
                if(order == 3)
                {
                    glMap2f(GL_MAP2_VERTEX_3, 0.0, 1.0, 3, this->order, 0.0, 1.0, 3*(this->order), this->order, &(this->vecControlPointsOrder3[0][0]));

                    // so' para referencia visual... onde estao os quatro pontos
                    // de controlo:
                    glDisable(GL_TEXTURE_2D);
                    glColor3f(1.0, 1.0, 0.0);
                    for (int i = 0; i < 4; i++)
                    {
                        glRasterPos3f(this->vecControlPointsOrder3[i][0],this->vecControlPointsOrder3[i][1],this->vecControlPointsOrder3[i][2]);
                        glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, '0'+i);
                    }
                }
        
        glMap2f(GL_MAP2_NORMAL,   0.0, 1.0, 3, this->order,  0.0, 1.0, 3*(this->order), this->order,  &planeNormals[0][0]);
        glMap2f(GL_MAP2_COLOR_4,  0.0, 1.0, 4, this->order,  0.0, 1.0, 4*(this->order), this->order,  &planeColors[0][0]);
        glMap2f(GL_MAP2_TEXTURE_COORD_2,  0.0, 1.0, 2, this->order, 0.0, 1.0, 2*(this->order), this->order,  &textPoints[0][0]);
        
        
        // When we actually go to evaluate and render the evaluator map as a 2D mesh, we need to indicate the number of partitions of U and V (number of grid rows and columns) and over what region of the parametric U and V domain we will iterate across. So we tell OpenGL to iterate across the full 0.0 to 1.0 range setup above with 5 rows and 6 columns. This is done with glMapGrid2f:
        glMapGrid2d(this->partsU, 0.0, 1.0,this->partsV, 0.0, 1.0);
        
        // os interpoladores activam-se:
        glEnable(GL_MAP2_VERTEX_3);
        glEnable(GL_MAP2_NORMAL);
        glEnable(GL_MAP2_COLOR_4);
        glEnable(GL_MAP2_TEXTURE_COORD_2);
        glEnable(GL_TEXTURE_2D);
        
        glBindTexture(GL_TEXTURE_2D, 4);
        
        //After this setup is performed, a single OpenGL command evaluates and renders the specified grid as an evaluator mesh:
        if(this->compute == "point")
        {
            glEvalMesh2(GL_POINT, 0.0, this->partsU, 0.0, this->partsV);
        }
        else
            if(this->compute == "line")
            {
                glEvalMesh2(GL_LINE, 0.0, this->partsU, 0.0, this->partsV);
            }
            else if(this->compute == "fill")
            {
                glEvalMesh2(GL_FILL, 0.0, this->partsU, 0.0, this->partsV);
            }
        
        glDisable(GL_MAP2_VERTEX_3);
        glDisable(GL_MAP2_NORMAL);
        glDisable(GL_MAP2_TEXTURE_COORD_2);
        glDisable(GL_TEXTURE_2D);
        
        glDisable(GL_COLOR_MATERIAL);
        
    }