bonjour, je ne sais pas comment mettre de la couleur au primitif de glut en c++ pourriez vous me le montrer voici mon code source:
#include <gl\glut.h>
void Reshape(int w, int h);
void Affichage();
int main(int argc, char**argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE);
glutInitWindowSize(1000,800);
glutInitWindowPosition(50,50);
glutCreateWindow("Ma premiére fênetre OpenGL");
glClearColor(0,0,0,0);
glutDisplayFunc(Affichage);
glutReshapeFunc(Reshape);
glutMainLoop ();
return 0;
}
void Affichage()
{
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(5,2,-10,0,0,0,5,2,2);
glutWireSphere (3,100,100);
glutSwapBuffers();
}
void Reshape(int w, int h)
{
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glViewport(0,0,w,h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45,(float) w/h,1.,1000.);
}
ma sphére st blanche par défaut.
Partager