title: Drawing using Vertex Buffer Objects in OpenGL ES 1.1 vs ES 2.0
body: <p>i am new to openGL. Iam using apple documentation as my major referens
  <a href="http://developer.apple.com/library/ios/#documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/TechniquesforWorkingwithVertexData/TechniquesforWorkingwithVertexData.html#//apple_ref/doc/uid/TP40008793-CH107-SW6" rel="nofollow">http://developer.apple.com/library/ios/#documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/TechniquesforWorkingwithVertexData/TechniquesforWorkingwithVertexData.html#//apple_ref/doc/uid/TP40008793-CH107-SW6</a></p>
  
  <p>My problem is that i am using openGL ES <strong>1.1</strong> and not <strong>2</strong> thus functions which are used in Listing 9-3 such as <strong>glVertexAttribPointer</strong>, <strong>glEnableVertexAttribArray</strong> are not recognized ... :)</p>
  
  <p>I trying to make the optimizations which are described in this documentation:
  to hold indices and vertex as a struct with all of its  data: position, color (Listing 9-1)</p>
  
  <pre><code>typedef struct _vertexStruct
  {
    GLfloat position[3];
    GLubyte color[4];
  } VertexStruct;
  
  const VertexStruct vertices[] = {...};
  const GLushort indices[] = {...};
  </code></pre>
  
  <p>and to use VBOs such as in Listing 9-2, 9-3</p>
  
  <p>As i mentioned, some of the functions that are used there don't exists in openGL ES 1.1. I am wondering if there is a way to do the same in ES 1.1 maybe with some other code ?</p>
  
  <p>thank,
  Alex</p>
  
  <hr>
  
  <p>Edit according to Christians answer, tried to use glVertexPointer, glColorPointer. 
  Here is the code, it prints the cube but no colors ... :(. Anyone, is it possible to use
  VBOs in such menner using ES 1.1</p>
  
  <pre><code>typedef struct {
      GLubyte red;
      GLubyte green;
      GLubyte blue;
      GLubyte alpha;
  } Color3D;
  
  typedef struct {
      GLfloat x;
      GLfloat y;
      GLfloat z;
  } Vertex3D;
  
  typedef struct{
     Vector3D position;
     Color3D color;
  } MeshVertex;
  </code></pre>
  
  <p><strong>Cube Data:</strong></p>
  
  <pre><code>static const MeshVertex meshVertices [] =
  {
  
      { { 0.0, 1.0, 0.0 } , { 1.0, 0.0, 0.0 ,1.0 } },
      { { 0.0, 1.0, 1.0 } , { 0.0, 1.0, 0.0 ,1.0 } },
      { { 0.0, 0.0, 0.0 } , { 0.0, 0.0, 1.0 ,1.0 } },
      { { 0.0, 0.0, 1.0 } , { 1.0, 0.0, 0.0, 1.0 } },
      { { 1.0, 0.0, 0.0 } , { 0.0, 1.0, 0.0, 1.0 } },
      { { 1.0, 0.0, 1.0 } , { 0.0, 0.0, 1.0, 1.0 } },
      { { 1.0, 1.0, 0.0 } , { 1.0, 0.0, 0.0, 1.0 } },
      { { 1.0, 1.0, 1.0 } , { 0.0, 1.0, 0.0, 1.0 } }
  
  };
  
  static const GLushort meshIndices [] =
  {   0, 1, 2 , 
      2, 1, 3 , 
      2, 3, 4 ,
      3, 5, 4 ,
      0, 2, 6 ,
      6, 2, 4 ,
      1, 7, 3 ,
      7, 5, 3 ,
      0, 6, 1 ,
      1, 6, 7 , 
      6, 4, 7 , 
      4, 5, 7 
  };
  </code></pre>
  
  <p><strong>Function</strong></p>
  
  <pre><code>GLuint vertexBuffer;
  GLuint indexBuffer;
  
  - (void) CreateVertexBuffers 
  { 
      glGenBuffers(1, &amp;vertexBuffer);
      glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);
      glBufferData(GL_ARRAY_BUFFER, sizeof(meshVertices), meshVertices, GL_STATIC_DRAW);
  
      glGenBuffers(1, &amp;indexBuffer);
      glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer);
      glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(meshIndices), meshIndices, GL_STATIC_DRAW);
  
  }
  
  - (void) DrawModelUsingVertexBuffers
  {
      glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);
      glVertexPointer(3, GL_FLOAT, sizeof(MeshVertex), (void*)offsetof(MeshVertex,position));
      glEnableClientState(GL_VERTEX_ARRAY);
  
  
      glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(MeshVertex), (void*)offsetof(MeshVertex,color));
      glEnableClientState(GL_COLOR_ARRAY);
  
      glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer);  
      glDrawElements(GL_TRIANGLE_STRIP, sizeof(meshIndices)/sizeof(GLushort), GL_UNSIGNED_SHORT,    (void*)0);
  
      glDisableClientState(GL_VERTEX_ARRAY);
      glDisableClientState(GL_COLOR_ARRAY);
  }
  </code></pre>