changing OpenGL vertex values
<p>I want change vertex values in openGL and I have found a way to change it but threre is a wrong , the program draw a triangle and when I change vertex values in runtime I see rectangle , what is wrong ?? </p>

<p>the code</p>

<pre><code>#include "stdAfx.h"
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;glut.h&gt;
void DataSource();
void showObject();
void cont();

void inti(int argcp,char **argv)
{
glutInit(&amp;argcp,argv);
glutInitWindowSize(500,500);
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
glutCreateWindow("square");
glClearColor(0.0,0.0,0.0,0.0);


glutDisplayFunc(showObject);
glutIdleFunc(cont);
}

 int main(int argcp,char **argv)
 {
inti(argcp,argv);
DataSource(0.1);
glutMainLoop();
return 0;
 }

void DataSource(float adding)
 {
GLfloat triangle1[]={(-0.9+adding),0.3+adding,(-0.9+adding),0.8+adding,      (-0.4+adding),0.8+adding,  -0.9,0.3,-0.4,0.8,-0.4,0.3};

   glEnableClientState(GL_VERTEX_ARRAY);

glVertexPointer(2,GL_FLOAT,0,triangle1);
  }

void showObject()
{

 glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

    glDrawArrays(GL_TRIANGLES,0,3);

glutPostRedisplay();
glutSwapBuffers();
     }

    void cont()
      {
glutPostRedisplay();
     }
</code></pre>
