Memory issue in offscreen rendering


I face a problem with texture rendering in offscreen rendering mode. I have a huge set of vertices (formed by accumulation) rendered onto an FBO. The vertex structure includes actual vertices, texture vertices and the color data. Element array buffer is also formed with the given index data. When the total number of indices exceeds a certain limit the frame is not drawn. Neither does it throw any glError. It is not the number of indices drawn at one stretch, but the total number of indices for the entire frame when exceeds a certain limit gives the problem. I do delete the vbo-s created as and when it is rendered. Can someone tell me what might be the cause of this problem. Is there something that I am missing out.

The same code works properly when rendered directly onto the surface instead of FBO.

Also the problem occurs only in Motorola Milestone and works properly with Samsung Galaxy Tab.

GLuint* uiVbos = new GLuint[2];

glGenBuffers(2, uiVbos);

// Bind the VBOs and fill them with data

glBindBuffer(GL_ARRAY_BUFFER, uiVbos[0]);

glBufferData(GL_ARRAY_BUFFER, sizeof(paNewTexVertices) * iNumLines * 8, paNewTexVertices, GL_STATIC_DRAW);

glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, uiVbos[1]);

glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(pauiNewIndices) * iNumLines * 18, pauiNewIndices, GL_STATIC_DRAW);

glEnable( GL_TEXTURE_2D);

glVertexPointer(3, GL_FLOAT, sizeof(STexVertex3D), (GLvoid
)offsetof(STexVertex3D, vPosition));

glTexCoordPointer(2, GL_FLOAT, sizeof(STexVertex3D), (GLvoid
)offsetof(STexVertex3D, vTexcoord));

glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(STexVertex3D), (GLvoid*)offsetof(STexVertex3D, uiColor));

glBindTexture(GL_TEXTURE_2D, *Texture1);

glDrawElements(GL_TRIANGLES, iNumLines * 18, GL_UNSIGNED_SHORT, 0);

if( bFillInner )


     glBindTexture(GL_TEXTURE_2D, *Texture2);

     glDrawElements(GL_TRIANGLES, iNumLines * 18, GL_UNSIGNED_SHORT, 0);


glBindBuffer(GL_ARRAY_BUFFER, 0);


glDisable( GL_TEXTURE_2D);

glDeleteBuffers(2, uiVbos);

delete[] uiVbos;