C++ openGL #12: Draw Triangle Fan

Bismillahir Rahmanir Rahim
Assalamualaikum everyone!! 

_________________________________

Now i'm showing you how draw the Triangle Fan in openGL C++. Its  so easy tutorial just for beginners and basic concept of graph.
Let's enjoy!

>>>Now Create a new project-----
initialize the graph
void Initialize() {
 glClearColor(0, 0, 0, 1.0);
 glMatrixMode(GL_PROJECTION);
 glLoadIdentity();
 glOrtho(-10.0, 10.0, -10.0, 10.0, -10.0, 10.0);
}
glOrtho(-10.0, 10.0, -10.0, 10.0, -10.0, 10.0);

this method,
Declare a 10x10 graph like below ___
Now write code for draw object or lines
At first draw a graph like this one:

Now just put the value on your program between glBegain and glEnd.
when put the vertex on your program you mast follow a sequence  like this

void Draw() {
 glClear(GL_COLOR_BUFFER_BIT);
 glColor3d(0,0,0);
 glBegin(GL_TRIANGLE_FAN);
    glVertex2f(0.0,0.0);
    glVertex2f(0.0,3.0);
    glVertex2f(2.0,3.0);
 glVertex2f(3.0,2.0);
    glVertex2f(3.50,.50);
    glVertex2f(3.0,-1.0);
    glVertex2f(2.0,-2.0);
    glVertex2f(0.0,-2.50);
 glVertex2f(-2.0,-2.0);
    glVertex2f(-3.0,-1.0);
 glEnd();
 glFlush();
}

For more clarification download source file:





Socializer Widget By Blogger Yard
SOCIALIZE IT →
FOLLOW US →
SHARE IT →