الالوان وأمور اخرى متعلقة بالرسم (opengl ) السلام عليكم .. نواصل الكلام .. في هذه السلسلة طيبة الذكر .. <_< الموضوع سهل : الالوان : اذا اردنا تلوين جسم ما نستخدم glColor ,, طبعا هناك نوعين رئيسين من الالوان يستخدمهما opengl ... RGBA RGB اذا اردت المزيد من الشرح .. http://www.arabteam2...showtopic=83756
glColor3f (1.0, 0.0, 0.0); glBegin (GL_POINTS); glVertex3fv (point_array);glEnd ();
glLoadIdentity(); glTranslatef(0,0,-3.0); glColor3f (1.0, 0.0, 0.0); glBegin(GL_QUADS); glVertex3f(1,0,0); glVertex3f(-1,0,0); glVertex3f(-1,1,0); glVertex3f(1,1,0); glEnd();
glColor3f (1.0, 1.0, 1.0);
glColor3f (221211.0, 23123121.0, 41242311.0);
glColor3f (0.5, 1.0, 1.0);
glColor3b (GLbyte red, GLbyte green, GLbyte blue);
glColor3ub (GLbyte red, GLbyte green, GLbyte blue);
glColor3ub (111, 222, 111);
glColor3b (127, 127, 127); glColor3ub (255, 255, 255); glColor3f (1.0, 1.0, 1.0);
glColor4f( R ,G, B , A );
glLoadIdentity(); glTranslatef(0,0,-3.0); glBegin(GL_QUADS); glColor3ub (222, 12, 127); glVertex3f(1,0,0); glColor3ub (111, 211, 222); glVertex3f(-1,0,0); glColor3ub (255, 255, 0); glVertex3f(-1,1,0); glColor3ub (255, 0, 0); glVertex3f(1,1,0); glEnd();
glShadeModel(GL_FLAT);
glShadeModel(GL_SMOOTH);
void APIENTRY glPolygonMode (GLenum face, GLenum mode);
static int angle=0; void Render(){ glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); angle+=1; glPointSize(3); glLoadIdentity(); glTranslatef(0,0,-3.0); glRotatef(angle,0,1,0); glPolygonMode(GL_FRONT ,GL_LINE ); glPolygonMode(GL_BACK ,GL_POINT ); glRectf(0,0,1,1);}
glPolygonMode(GL_FRONT_AND_BACK ,GL_FILL );
void glLineStipple(GLint factor, GLushort pattern);
glLineStipple(1, 0x5555);
glLineStipple(4, 0x0C0F);
glEnable(GL_LINE_STIPPLE); glLineStipple(4, 0xAAAA); glBegin(GL_LINES); glVertex3f(-0.3,0,0); glVertex3f( 0.3,0,0); glEnd();
void Render(){ glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); glLoadIdentity(); glTranslatef(0,0,-3.0); glEnable(GL_LINE_STIPPLE); glLineStipple(1, 0xff00 ); glBegin(GL_LINES); glVertex3f(-1,0,0); glVertex3f( 1,0,0); glEnd();}
glLineStipple(1, 0xff00 );
1111110000111111
FFFF1111111111111111
DDFD1101110111111101
glLineStipple(4, 0xAAAA);
void glEdgeFlag(GLboolean flag);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); glBegin(GL_POLYGON); glVertex3f(-0.3,0,0); glVertex3f(0,0.3,0); glVertex3f(0.3,0,0); glEnd();
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); glBegin(GL_POLYGON); glEdgeFlag(GL_TRUE); glVertex3f(-0.3,0,0);//الرأس الايسر glEdgeFlag(GL_FALSE); glVertex3f(0.3,0,0);//الرأس الايمن glEdgeFlag(GL_TRUE); glVertex3f(0,0.3,0);//الرأس العلوي glEnd();
glEdgeFlag(GL_FALSE); glVertex3f(0.3,0,0);
glVertex3f(0.3,0,0)
glVertex3f(0,0.3,0)
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); glBegin(GL_POLYGON); glEdgeFlag(GL_TRUE); glVertex3f(-0.3,0,0); glEdgeFlag(GL_TRUE); glVertex3f(0.3,0,0); glEdgeFlag(GL_FALSE); glVertex3f(0,0.3,0); glEnd();
glEdgeFlag(GL_FALSE); glVertex3f(-0.3,0,0); //الرأس الايسر glEdgeFlag(GL_TRUE); glVertex3f(0.3,0,0); //الرأس الايمنglEdgeFlag(GL_TRUE); glVertex3f(0,0.3,0);//الرأس العلوي
void glRectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 );
glRectf(-0.4 ,-.4 ,0,0 );