I'm now starting to learn Opengl tutorials from Wikibooks[http://en.wikibooks.org/wiki/OpenGL_Programming]. In the tutorial 02[http://en.wikibooks.org/wiki/OpenGL_...L_Tutorial_02]. They taught to use VBO's. I did and the code compiles succesfully. but when I execute the program. the attribute "coord2d" from vertex shader is not able to bind with the "attribute_coord2d". look at the bold faced code segment.

here is the code
Code :
 
GLuint program;
GLint attribute_coord2d;
GLint  link_ok = GL_FALSE; 
GLint vbo_triangle;
 
 
int init_resources(void)
{
 
  GLuint vs = create_shader("triangle_01.vs.glsl",GL_VERTEX_SHADER);
  GLuint fs = create_shader("triangle_01.fs.glsl",GL_FRAGMENT_SHADER);
 
  program = glCreateProgram();
  glAttachShader(program, vs);
  glAttachShader(program, fs);
  glLinkProgram(program);
  glGetProgramiv(program, GL_LINK_STATUS, &link_ok);
  if (!link_ok) {
    fprintf(stderr, "glLinkProgram:");
    return 0;
  }
 
 
  GLfloat triangle_vertices[] = {
     0.0,  0.8,
    -0.8, -0.8,
     0.8, -0.8,
  };
 
 glVertexAttribPointer(
    attribute_coord2d, // attribute
    2,                 // number of elements per vertex, here (x,y)
    GL_FLOAT,          // the type of each element
    GL_FALSE,          // take our values as-is
    0,                 // no extra data between each position
    triangle_vertices  // pointer to the C array
  );
 
  glGenBuffers(1,&vbo_triangle);
  glBindBuffer(GL_ARRAY_BUFFER, vbo_triangle);
  glBufferData(GL_ARRAY_BUFFER,sizeof(triangle_vertices),
	       triangle_vertices, GL_STATIC_DRAW);
 
[B]
  const char* attribute_name = "coord2d";
  attribute_coord2d = glGetAttribLocation(program, attribute_name);
  if (attribute_coord2d == -1) {
    fprintf(stderr, "Could not bind attribute %s\n", attribute_name);
    return 0;
  }[/B]
 
// Enable alpha
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 
  return 1;
}


and the vertex shader code is:
Code :
attribute vec2 coord2d;
void main(void) {
  gl_Position = vec4(coord2d, 0.0, 1.0);
}