السلام عليكم يا أخوان ..
انا بآخد مادة أسمها الرسوم بالحاسوب . او Computer Graphics
حيث تستخدم برمجة الc++ في رسم الخطوط والدوائر وأشياء أكبر من هيك بكثير ..
انا بدي من الاخوان اعطائي دروس على هذه الكودات .. اللي بتخص الgraphic
مثلا عندي هالكود لرسم خط مائل ..
#include<stdlib.h>
#include<math.h>
#include<gl/glut.h>
/* inline int round(const float a){return int(a+0.5);}
void lineDDA(int x0,int y0,int xEnd, int yEnd)
{
int dx=xEnd-x0;
int dy=yEnd-y0;
int steps,k;
float xIncrement,yIncrement,x=x0,y=y0;
if(fabs (dx) > fabs(dy))
steps =fabs(dx);
else
steps =fabs(dy);
xIncrement=float(dx)/ float(steps);
yIncrement=float(dy)/ float(steps);
setPixel(round(x),round(y));
for(k=0;k<steps;k++)
{
x+=xIncrement;
y+=yIncrement;
setPixel(x,y);
}
}
void setPixel(int xcoord,int ycoord)
{
glBegin(GL_POINTS);
glVertex2i(xcoord,ycoord);
glEnd();
}
*/
void init(void)
{
glClearColor(0.0 , 0.005 , 0.0 , 0.0);
glMatrixMode(GL_PROJECTION);
gluOrtho2D(100.0,150.100,0.0,150.0);
}
void LineSegment(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0,1.0,1.0);
glBegin(GL_LINE_STRIP);
glVertex2i(180,50);
glVertex2i(10,145);
glEnd();
glFlush();
}
void main(int argc,char **argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_RGB);
glutInitWindowPosition(50,100);
glutInitWindowSize(400,300);
glutCreateWindow("First Example");
init();
glutDisplayFunc(LineSegment);
glutMainLoop();
}أرجو المساعدة
