سلام ....هذا الكود ماشي ميه ميه open GL بفيجوال سي ++ يرتك تساعدوني و تخلو عقرب الثواني يدور علي طول مني عارفة كيف أخليه يتحرك ...يعني أريد انه من ساعة ما يطلع الرن يكون عقرب الثواني بيدور ....ولكم مقدما جزيل الشكر....
#include <GL/glut.h>
#define PI_ 6.28
#include<stdlib.h>
#include<math.h>
int i,r;
void display(void)
{
glBegin(GL_TRIANGLES);
glColor3f (0.0, 0.5, 0.5);
glVertex2i(500, 100);
glColor3f (1.0, 0.5, 0.5);
glVertex2i(300, 200);
glColor3f (1.0, 1.5, 0.5);
glVertex2i(700, 200);
glEnd();
glFlush();
glBegin(GL_TRIANGLES);
glColor3f (0.3, 0.5, 0.5);
glVertex2i(500, 800);
glColor3f (1.0, 0.5, 0.5);
glVertex2i(300, 700);
glColor3f (1.0, 1.5, 0.5);
glVertex2i(700, 700);
glEnd();
glFlush();
glBegin(GL_TRIANGLES);
glColor3f (1.5, 9.5, 0.5);
glVertex2i(700, 700);
glColor3f (1.0, 0.2, 0.7);
glVertex2i(900, 650);
glColor3f (7.3, 7.5, 0.4);
glVertex2i(900, 450);
glEnd();
glFlush();
glBegin(GL_TRIANGLES);
glColor3f (1.3, 0.5, 0.5);
glVertex2i(900, 450);
glColor3f (0.0, 0.5, 0.5);
glVertex2i(900, 250);
glColor3f (0.9, 8.5, 0.5);
glVertex2i(700, 200);
glEnd();
glFlush();
glBegin(GL_TRIANGLES);
glColor3f (5.4, 0.5, 0.5);
glVertex2i(300, 200);
glColor3f (1.0, 0.2, 0.7);
glVertex2i(100, 450);
glColor3f (0.3, 5.5, 0.5);
glVertex2i(100, 250);
glEnd();
glFlush();
glBegin(GL_TRIANGLES);
glColor3f (1.4, 0.5, 0.5);
glVertex2i(100, 450);
glColor3f (0.3, 0.2, 0.7);
glVertex2i(100, 650);
glColor3f (0.9, 8.5, 0.5);
glVertex2i(300, 700);
glEnd();
glFlush();
glBegin (GL_POLYGON);
glColor3f (0.9, 8.5, 0.5);
glVertex2i(485, 435);
glVertex2i(515, 435);
glVertex2i(515, 465);
glVertex2i(485, 465);
glEnd();
glFlush();
glLineWidth (5.0);
glBegin (GL_LINE_STRIP);
glColor3f (0.9, 8.5, 0.5);
glVertex2i (500,450);
glVertex2i (500,640);
glVertex2i (500,450);
glVertex2i (675,450);
glEnd ();
glFlush();
glBegin(GL_TRIANGLES);
glColor3f (0.9, 8.5, 0.5);
glVertex2i(500, 660);
glVertex2i(475, 640);
glVertex2i(525, 640);
glEnd();
glFlush();
glBegin(GL_TRIANGLES);
glColor3f (0.9, 8.5, 0.5);
glVertex2i(675, 425);
glVertex2i(675, 475);
glVertex2i(700,450 );
glEnd();
glFlush();
glLineWidth (3.75);
glBegin (GL_LINE_STRIP);
glVertex2i (500,450);
glVertex2i (325,300);
glEnd ();
glFlush();
glBegin (GL_POINTS);
glColor3f (1.5, 0.5, 0.5);
glVertex2i (500,675);
glVertex2i (800,450);
glVertex2i (200,450);
glVertex2i (500,225);
glEnd ();
glFlush();
glLineWidth (2.0);
glBegin (GL_LINES);
glColor3f (0.9, 8.5, 0.5);
glVertex2i (640,660);
glVertex2i (630,650);
glVertex2i (750,550);
glVertex2i (735,540);
glVertex2i (640,230);
glVertex2i (625,240);
glVertex2i (760,320);
glVertex2i (740,335);
glVertex2i (330,230);
glVertex2i (340,240);
glVertex2i (220,330);
glVertex2i (240,340);
glVertex2i (220,550);
glVertex2i (240,540);
glVertex2i (330,660);
glVertex2i (340,650);
glEnd ();
glFlush();
}
void main (int argc, char** argv)
{
glutInit (&argc, argv); // Initialize GLUT.
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);// Set display mode.
glutInitWindowPosition (400, 200); // Set top-left display-window position.
glutInitWindowSize (400, 400); // Set display-window width and hight.
glutCreateWindow ("... SHAIMAA ..."); // Create display window
glClearColor(0.4, 0.4, 5.0, 5.0); // Set display-window background color to blue.
glClear (GL_COLOR_BUFFER_BIT); // Clear display window.
glPointSize (7.0); // Set points size to 7 .
glMatrixMode(GL_PROJECTION); // Setup viewing projection .
glLoadIdentity();
gluOrtho2D(0.0, 1000.0, 0.0, 1000.0); // Setup a 10x 10x2 world ( Set projection parameters).
glutDisplayFunc (display); // Send graphics to display window.
glutMainLoop(); // Display everything and wait.
}