   Trying to render a textured cube via indexed VBO
  Hi,spending hours, i'm trying to draw a textured cube via OpenGl with VBO. First, the cube will be rendered. But there are only two sides of my cube textured.Here's my vertices/indices/texture coord setup:GLfloat vertices [] ={-1.0f, 1.0f, 0.0f,-1.0f,-1.0f, 0.0f, 1.0f,-1.0f, 0.0f, 1.0f, 1.0f, 0.0f,-1.0f, 1.0f, -2.0f,-1.0f,-1.0f, -2.0f, 1.0f,-1.0f, -2.0f,    1.0f, 1.0f, -2.0f,};GLfloat tex[] ={ 1.0f,1.0f, // 10.0f,1.0f,0.0f,0.0f,    1.0f,0.0f,    1.0f,1.0f, // 2    0.0f,1.0f,    0.0f,0.0f,1.0f,0.0f,1.0f,1.0f, // 3    0.0f,1.0f,    0.0f,0.0f,1.0f,0.0f,1.0f,0.0f, // 4    0.0f,0.0f,    0.0f,1.0f,1.0f,1.0f,1.0f,0.0f, // 50.0f,0.0f,    0.0f,1.0f,1.0f,1.0f,1.0f,0.0f, // 6    0.0f,0.0f,    0.0f,1.0f,1.0f,1.0f,};GLuint indices[] = {0,1,2,3,4,5,6,7,3,2,6,7,0,1,5,4,4,0,3,7,5,1,2,6,}; GLuint triangleBuffer;GLuint indexBuffer;#define BUFFER_OFFSET(i) ((char *)NULL + (i))#define NUM_VERTICES 24My window get's initialized via SFML and the texture is loaded.After that i do OpenGL setup stuff and then initialize the VBO Buffers:    glColor4f(1.f, 1.f, 1.f, 1.f);    glEnableClientState(GL_VERTEX_ARRAY);    glEnableClientState(GL_TEXTURE_COORD_ARRAY);    glGenBuffers(1,&indexBuffer);    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer);    glBufferData(GL_ELEMENT_ARRAY_BUFFER, 24*sizeof(GLuint), indices,   GL_STREAM_DRAW);glGenBuffers(1, &triangleBuffer);glBindBuffer(GL_ARRAY_BUFFER, triangleBuffer);glBufferDataARB(GL_ARRAY_BUFFER, NUM_VERTICES*(sizeof(GLfloat))+24*2*sizeof(GLfloat), NULL, GL_STATIC_DRAW);glBufferSubData(GL_ARRAY_BUFFER,0,NUM_VERTICES*sizeof(GLfloat),vertices);//glBufferSubData(GL_ARRAY_BUFFER, NUM_VERTICES*(sizeof(GLfloat) ), 24*2*sizeof(GLfloat), tex);glVertexPointer(3, GL_FLOAT, 0,0);glTexCoordPointer(2, GL_FLOAT, 0,   BUFFER_OFFSET(NUM_VERTICES*(sizeof(GLfloat))));    // Setup a perspective projection    glMatrixMode(GL_PROJECTION);    glLoadIdentity();    gluPerspective(1.f, 1.f, 1.f, 500.f);    // Start game loop    while (App.IsOpened())    {glClear( GL_COLOR_BUFFER_BIT);   // Apply some transformationsglMatrixMode(GL_MODELVIEW);   glLoadIdentity();glTranslatef(0.f, 0.f, -200.f);glRotatef(Clock.GetElapsedTime() * 50, 1.f, 0.f, 0.f);glRotatef(Clock.GetElapsedTime() * 30, 0.f, 1.f, 0.f);glRotatef(Clock.GetElapsedTime() * 90, 0.f, 0.f, 1.f);// draw it !glDrawElements(GL_QUADS,  6*4, GL_UNSIGNED_INT, BUFFER_OFFSET( 0 ));   // Finally, display rendered frame on screen   App.Display();    } // Game LoopDid I miss something ? Has anyone a clue ?Thanks in advance,Chris   
  You have shared vertices but not shared texture coordinates. If you share a vertex, you must share the texture coordinate as well, because the same index is used to reference all enabled attribute arrays. You should immediately know something is wrong when you have attribute arrays of different size; your vertex array contains 8 vertices but the texture coordinate array contains 24 texture coordinates.You will, however, find that the cube is the worst case with no shared vertices (or possible a handful, depending on how you orient your texture on each face), and you need 24 unique vertices.   ;  Thanks a lot. I'll try that.   