In the below code i use vertex arrays to draw some objects to the texture through FBO, then i use VBO's to draw a cube and apply the texture to the cube.

But while i execute the below code, i do not get the objects in the texture. The cube is textured with the "colors" specified through "glColorPointer".

Please tell me identify my mistakes.

Thank you very much.
Code :
glEnable(GL_DEPTH_TEST); 
  glEnable(GL_TEXTURE_2D);  
 
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
 
  glGenTextures(1, &texture);
  glBindTexture(GL_TEXTURE_2D, texture);
  glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
  glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
  glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
  glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
  glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
  glBindTexture(GL_TEXTURE_2D, 0);
 
  glGenFramebuffersEXT(1, &framebuffer);
  glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, framebuffer);
 
  glGenRenderbuffersEXT(1, &depth_rb);
  glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, depth_rb);
  glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT24_EXT, 256, 256);
  glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0);
 
  glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, texture, 0);
  glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, depth_rb);  
 
  if(glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) == GL_FRAMEBUFFER_COMPLETE_EXT)  {    
 
    glClearColor(1.0f, 1.0f, 0.0f,1.0f);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
    glDisable(GL_TEXTURE_2D);        
 
    glEnableClientState(GL_COLOR_ARRAY);
    glColorPointer(4, GL_FLOAT, 0, colors);
 
    glEnableClientState(GL_VERTEX_ARRAY);
    glVertexPointer(3, GL_FLOAT, sizeof(GLfloat) *  5, objects);
 
    glPushMatrix();
    glRotatef((GLfloat)30, -1.0, 0.0, 0.0f);
    glDrawElements(GL_TRIANGLES, sizeof(object), GL_UNSIGNED_BYTE, object);         
    glPopMatrix();
 
    glDisableClientState(GL_VERTEX_ARRAY);
  }
 
  glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
 
  glMatrixMode(GL_MODELVIEW);
  glEnable(GL_DEPTH_TEST);
  glDepthFunc(GL_LESS);
 
  glGenBuffers(1, &buffer);
  glBindBuffer(GL_ARRAY_BUFFER, buffer);
  glBufferData(GL_ARRAY_BUFFER, 8 * (sizeof(GLfloat) * 5), cube, GL_STATIC_DRAW);
 
  glEnableClientState(GL_VERTEX_ARRAY);
  glVertexPointer(3, GL_FLOAT, sizeof(GLfloat) * 5, 0);
  glClearColor(1.0f,1.0f,1.0f,1.0f);
  glClear(GL_COLOR_BUFFER_BIT |  GL_DEPTH_BUFFER_BIT); 
  glEnable(GL_TEXTURE_2D);
 
  glBindTexture(GL_TEXTURE_2D, texture);
  glEnableClientState(GL_TEXTURE_COORD_ARRAY);
  glTexCoordPointer(2, GL_FLOAT, sizeof(GLfloat) * 5, (GLvoid *)(sizeof(GLfloat) * 3));
  glDrawElements(GL_TRIANGLES, sizeof(cube_index),GL_UNSIGNED_BYTE, cube_index);