¿Cómo dibujar un arco usando opengl? Conoce las coordenadas del centro del círculo, el punto inicial y el punto final del arco. Está bien hablar de ideas... sería mejor si hubiera un programa fuente.
¿#Contiene? & ltstdio.h & gt
#¿Contiene? & ltstdlib.h & gt
GLuint? startList
¿No es válido? inicio(nulo)?
{
GLUquadricObj? * qobj
listaInicio? =?glGenLists(1);
qobj? =?glunequadric();
gluQuadricDrawStyle(qobj,?glu_silhouette);? /*?Dibujar solo bordes*/
glucquadricnormals(qobj, GLU_NONE); /*No vertical (dirección del vértice)*/
glNewList(startList, GL_COMPILE); y mostrar? La lista no está dibujada*/
gluPartialDisk(qobj,?0.0,?1.0,?20,?4,?0.0,?225.0);/*?El primer parámetro es? ¿Superficie cuadrática? Objeto, entonces el radio del círculo interior es 0,0, el radio del círculo exterior es 1,0 y el número de bloques a lo largo del eje z.
Los dos últimos parámetros son el ángulo inicial y el ángulo final del arco*/
glend list();
}
¿No es válido? display(no válido)
{
gl¿Borrar? (GL_COLOR_BUFFER_BIT?|?GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glColor3f(1.0,?1.0,?0.0);
glCallList(startList);
glPopMatrix();
GL flush();
}
¿No es válido? ¿Reinvención? (int?w,?int?h)
{
glViewport(0, 0,?(GLsizei)?w,?(GLsizei)?h);
glMatrixMode(GL_PROJECTION);
glload identidad();
¿Si? (w?<=?h)
Glotto(-2.5,?2.5,?-2.5*(GLfloat)h/(GLfloat)w,
2.5*( GLfloat)h /(GLfloat)w,? -10.0,?10.0);
Otros
glOrtho(-2.5 *(GL float)w/(GL float)h,
2.5*(GLfloat)w/(GLfloat)h,?-2.5,?2.5,?-10.0,?10.0);
glMatrixMode(vista GL_model);
p>glload identidad();
}
/*?ARGSUSED1? */
¿Anulado? Teclado (?char?key, ?int?x, ?int?y sin firmar)
{
¿Alternar? (llave)? {
¿Caso? 27:
Salir(0);
Pausa;
}
}
int? main(int?argc,?char**?argv)
{
Gelatina(&argc,?argv);
glutInitDisplayMode(GLUT_SINGLE? |?GLUT_RGB ? |?GLUT_DEPTH);
glutInitWindowSize(300,?300);?
glutInitWindowPosition(100,?100);
glutCreateWindow(argv[0]);
init();
glutDisplayFunc( espectáculo);?
glutReshapeFunc(modelado);
glutKeyboardFunc(teclado);
glutMainLoop();
¿Regresar? 0;
}