این فعلا اینجا باشه
يكشنبه, ۳۱ خرداد ۱۳۹۴، ۰۹:۲۹ ق.ظ
#include <GL/glut.h>
int Height = 400, Width = 800;
void DrawCircle(float x , float y , int size , float Rcolor , float Gcolor , float Bcolor)
{
glColor3f(Rcolor, Gcolor, Bcolor);
glEnable(GL_POINT_SMOOTH);
glPointSize(size);
glBegin(GL_POINTS);
glVertex2f(x , y);
glEnd();
}
void DrawTriangle()
{
glColor3f(0, 0, 0);
glBegin(GL_POLYGON);
glEnable(GL_POINT_SMOOTH);
glVertex2f(-.74, -.715);
glVertex2f(-.5 , -.6);
glVertex2f(-.65 , -.80);
glEnd();
}
void display(void)
{
glClearColor(1, 0, 0, 1);
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0,0,0);
glBegin(GL_POLYGON);
glEnable(GL_POINT_SMOOTH);
glVertex2f(-.95,-.9);
glVertex2f(-.95, 0.9);
glVertex2f(0.95, 0.9);
glVertex2f(0.95, -.9);
glEnd();
DrawCircle(.75,.70,100,1,1,0);//rast bala
//chap paeen
DrawCircle(-.75,-.70 , 100, 1, .5, 0);//sar
DrawCircle(-.72, -.65, 5, 0,0,0);//cheshm
DrawTriangle();
//bala rast
//bala chap
glutSwapBuffers();
}
int main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE);
glutInitWindowSize(Width, Height);
glutCreateWindow("Hello OpenGL World");
glutDisplayFunc(display);
glutMainLoop();
}
- ۹۴/۰۳/۳۱