Draw polygon

i used the code below to draw a rectangle. now i want to draw a six vertice POLYGON… any help please?

glTranslatef(3.0f,0.0f,0.0f); // Move Right 3 Units
glBegin(GL_POLYGON); // Draw A Quad
glVertex3f(-1.0f, 1.0f, 0.0f); // Top Left
glVertex3f( 1.0f, 1.0f, 0.0f); // Top Right
glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right
glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left
glEnd();

you just have to use glVertex3f to specify the 6 vertices like you did for the rectangle, for isntance:

glBegin(GL_POLYGON); // Draw A Quad
glVertex3f(-0.5f, 1.0f, 0.0f); // Top Left
glVertex3f(-1.0f, 0.0f, 0.0f); // Left
glVertex3f(-0.5f, 1.0f, 0.0f); // Bottom Left
glVertex3f(0.5f, 1.0f, 0.0f); // Top Right
glVertex3f(1.0f, 0.0f, 0.0f); // Right
glVertex3f(0.5f, 1.0f, 0.0f); // Bottom Right
glEnd();

Consider using GL_TRIANGLE_FAN instead.

how to implement GL_TRIANGLE_FAN?

is it possible to use GL_LINE to draw the vertex?

A GL_TRIANGLE_FAN is a set of triangles with 1 common point, the the case on a 6 vertex polygon it would be something like:

glBegin(GL_TRIANGLE_FAN); // Draw A 6 vertex polygon
glVertex3f(-0.5f, 1.0f, 0.0f); // Top Left
glVertex3f(-1.0f, 0.0f, 0.0f); // Left
glVertex3f(-0.5f, 1.0f, 0.0f); // Bottom Left
glVertex3f(0.5f, 1.0f, 0.0f); // Top Right
glVertex3f(1.0f, 0.0f, 0.0f); // Right
glVertex3f(0.5f, 1.0f, 0.0f); // Bottom Right
glEnd(); 

if you want to draw the outline of a polygon you can use GL_LINE_LOOP:

glBegin(GL_LINE_LOOP); // Draw A 6 vertex polygon
glVertex3f(-0.5f, 1.0f, 0.0f); // Top Left
glVertex3f(-1.0f, 0.0f, 0.0f); // Left
glVertex3f(-0.5f, 1.0f, 0.0f); // Bottom Left
glVertex3f(0.5f, 1.0f, 0.0f); // Top Right
glVertex3f(1.0f, 0.0f, 0.0f); // Right
glVertex3f(0.5f, 1.0f, 0.0f); // Bottom Right
glEnd(); 

This questions you are asking are the very basic about OpenGL primitives, you should read some introduction to OpenGL either online or on paper, to learn all sorts of primitives you can use.

If you like reading online check this 2 links:
http://www.graphics.cornell.edu/~spf/opengl/
http://fly.cc.fer.hr/~unreal/theredbook/

OpenGL SuperBible is also greate for beginners.