Objects using Line-Attribute, Fill-Area Attribute, Color functions of OpenGL
1. Load the libraries #include<GL/glut.h> #include<windows.h> 2. Create a display function where you will be drawing your shape and objects void display() { } 3. Give Screen color using ClearColor glClearColor(0.0,0.1,0.0,0.0); glClear(GL_COLOR_BUFFER_BIT); 4. Use factor and pattern to give some styles to your line. for more pattern click: GL_Pattern GLint factor=1; GLushort pattern=0x0c0f; 5. Enable the Stipple glEnable(GL_LINE_STIPPLE); // enabling the line pattern function glLineStipple(factor,pattern); 6.Draw the shape glColor3f(1.0,0.0,0.0); glBegin(GL_LINES); glVertex2f(0.0,0.0); glVertex2f(1.0,0.0); glEnd(); 7.disable the stipple then flush it. glDisable(GL_LINE_STIPPLE); glFlush(); 8. Main Function int main(int argc,char** argv) 9. Ii...