Curvas de bezier opengl

Solo disponible en BuenasTareas
  • Páginas : 5 (1079 palabras )
  • Descarga(s) : 4
  • Publicado : 21 de abril de 2010
Leer documento completo
Vista previa del texto
#include

void init(void)
{
glClearColor(0.0, 0.0, 0.0, 0.0);
glMatrixMode(GL_PROJECTION);
gluOrtho2D(-100.0, 1200.0, 0.0, 700.0);
}

void rellena(float *Puntos, int lineas){

//glMap2f(GL_MAP2_VERTEX_3, 0.0, 1, 3, 2,0.0, 1, 12, 2, Puntos);
// glMap1f(GL_MAP2_VERTEX_3, 0.0, 1, 3, 2,Puntos);
glEnable(GL_MAP2_VERTEX_3); //activa el evaluador
//glMapGrid2f(250, 0.0, 1.0, 250, 0.0, 1.0);
glMapGrid1f(600, 0.0, 1.0);
glEvalMesh2(GL_FILL, 0, 250, 0, 250);

}

void bezier2p(float *Puntos)
{ glMap1f(GL_MAP1_VERTEX_3, 0.0, 1, 3, 2, Puntos);
glEnable(GL_MAP1_VERTEX_3); //activa el evaluador
glMapGrid1f(600, 0.0, 1.0);
glEvalMesh1(GL_POINT, 0, 600);
glDisable(GL_MAP1_VERTEX_3);

}

void bezier3p(float *Puntos)
{glMap1f(GL_MAP1_VERTEX_3, 0.0, 1, 3, 3, Puntos);
glEnable(GL_MAP1_VERTEX_3); //activa el evaluador
glMapGrid1f(600, 0.0, 1.0);
glEvalMesh1(GL_POINT, 0, 600);
glDisable(GL_MAP1_VERTEX_3);
}
void bezier4p(float *Puntos)
{ glMap1f(GL_MAP1_VERTEX_3, 0.0, 1, 3, 4, Puntos);
glEnable(GL_MAP1_VERTEX_3); //activa el evaluador
glMapGrid1f(1450, 0.0, 1.0);glEvalMesh1(GL_POINT, 0, 1450);
glDisable(GL_MAP1_VERTEX_3);

}

void bezierp(GLfloat mat[][4][3])
{ glMap1f(GL_MAP1_VERTEX_3, 0.0, 1, 3, 4, &mat[0][0][0]);
glEnable(GL_MAP1_VERTEX_3); //activa el evaluador
glMapGrid1f(1450, 0.0, 1.0);
glEvalMesh1(GL_POINT, 0, 1450);
glDisable(GL_MAP1_VERTEX_3);
}
void CurvadeBezier(void)
{
//pierna trasera
floatPuntosdeControlpt1P[3][3]={{795, 310, 0}, {950, 295, 0},{970, 275, 0}};
float PuntosdeControlpt2P[4][3]={{970, 275, 0}, {1030, 165, 0}, {1070, 95, 0}, {1090, 75, 0}};
float PuntosdeControlpt3P[4][3]={{1090, 75, 0}, {1110, 70, 0}, {1130, 45, 0}, {1145, 45, 0}};
float PuntosdeControlpt4P[4][3]={{1145, 45, 0}, {1155, 35, 0}, {1145, 35, 0}, {1120, 35, 0}};
floatPuntosdeControlpt5P[4][3]={{1086, 48, 0}, {1086, 48, 0}, {1086, 48, 0}, {1120, 35, 0}};
float PuntosdeControlpt6P[3][3]={{1046, 43, 0}, {1066, 48, 0},{1086, 48, 0}};
float PuntosdeControlpt7P[3][3]={{1030, 73, 0}, {1026, 52, 0},{1046, 43, 0}};
float PuntosdeControlpt8P[4][3]={{950, 183, 0}, {950, 143, 0}, {1030, 103, 0}, {1030, 73, 0}};
float PuntosdeControlpt9P[3][3]={{680, 208, 0},{756,200, 0},{854, 213, 0}};
//cabeza
float PuntosdeControlh7P[4][3]={{160, 340, 0}, {180, 360, 0}, {190, 330, 0}, {250, 350, 0}};
float PuntosdeControlh6P[3][3]={{100, 320, 0}, {140, 370, 0},{160, 340, 0}};
float PuntosdeControlh5P[3][3]={{50, 340, 0}, {80, 340, 0},{100, 320, 0}};
float PuntosdeControlh4P[3][3]={{50, 340, 0}, {70, 360, 0},{80, 375, 0}};
floatPuntosdeControlh3P[4][3]={{80, 375, 0}, {95, 435, 0},{95, 405, 0},{115, 405, 0}};
float PuntosdeControlh2P[4][3]={{115, 405, 0}, {125, 415, 0}, {140, 435, 0}, {170, 435, 0}};
float PuntosdeControlh1P[3][3]={{170, 435, 0}, {190, 415, 0},{210, 385, 0}};
//cuello
float PuntosdeControlc2P[3][3]={{265, 385, 0}, {240, 385, 0},{210, 385, 0}};
// floatPuntosdeControl3P[3][3]={{-500, 0, 0.0}, {0, -100, 0}, {500, 0, 0}};240, 350, 0.0
float PuntosdeControlc1P[4][3]={{280, 405, 0.0}, {260, 375, 0}, {230, 325, 0}, {250, 280, 0}};

//bub
float PuntosdeControl0P[4][3]={{280, 405, 0.0}, {320, 485, 0}, {370, 485, 0}, {410, 410, 0}};
// float PuntosdeControl1P[4][3]={{290, 395, 0.0}, {330, 375, 0}, {360, 350, 0}, {410, 410, 0}};
//abdomen
floatPuntosdeControl2P[4][3]={{410, 410, 0}, {495, 410, 0}, {520, 370, 0}, {600, 370, 0}};
float PuntosdeControl3P[3][3]={{600, 370, 0}, {650, 350, 0},{670, 355, 0}};
//piernas
float PuntosdeControl4P[4][3]={{655, 325, 0}, {720, 435, 0}, {720, 500, 0}, {795, 560, 0}};
float PuntosdeControl5P[4][3]={{795, 560, 0}, {870, 590, 0}, {900, 520, 0}, {910, 350, 0}};
//espalda...
tracking img