[SOLVED] Rendering 1000s of quads to a VBO

I am trying to render 1000+ quads with a single VBO. How would I go about doing this? When I try to it only renders 1 quad.

Making VBOs

final StaticVBO[] texturedVBOs = new StaticVBO[textureSet.length];
				for (int index = 0; index < textureSet.length; index++) {
					ArrayList<Object> tiles = sorter.get(index);
					StaticVBO texturedVBO = new StaticVBO(4 * tiles.size(), textureSet[index].getID());
					Vertex[] vertices = new Vertex[4 * tiles.size()];
					TexCoord[] texCoords = new TexCoord[4 * tiles.size()];
					int vStart = 0;
					for (Object tileObject : tiles) {
						Tile tile = (Tile) tileObject;
						vertices[vStart] = Vertex.get(tile.x(), tile.y());
						vertices[vStart + 1] = Vertex.get(tile.x() + Tile.SIZE, tile.y());
						vertices[vStart + 2] = Vertex.get(tile.x() + Tile.SIZE, tile.y() + Tile.SIZE);
						vertices[vStart + 3] = Vertex.get(tile.x(), tile.y() + Tile.SIZE);
						texCoords[vStart] = new TexCoord(0, 0);
						texCoords[vStart + 1] = new TexCoord(1, 0);
						texCoords[vStart + 2] = new TexCoord(1, 1);
						texCoords[vStart + 3] = new TexCoord(0, 1);
						vStart += 4;
					}
					texturedVBO.uploadVertices(vertices);
					texturedVBO.uploadTextures(texCoords);
					texturedVBOs[index] = texturedVBO;
				}

Hope someone can help!
CopyableCougar4

Why don’t you just use batching with VAO’s instead?

I don’t think there’s enough info here. Are you sure it’s only rendering one quad? Does your VBO fill up?

Sorry if I didn’t clarify.

I have a VAO (haven’t looked at the core utility class in weeks :P) that renders an object given the vertices and texture coordinates. This works great but If I try to render more than one object, it doesn’t render after the first object. I know there is enough space because when the objects are created, they are told how many vertices will be uploaded.

I currently render 1000s of these objects, but it gets like 50fps and I want that much higher.

My overall question: How can I render 1000s of VAOs faster?

Hope this clarifies,
CopyableCougar4

how does the draw-call look like ?

usually we tell drawElements/Array/whatever how many primitives it should draw. might be a bug there.

Wow thanks! I feel like an idiot :slight_smile:

This [icode]glDrawArrays(GL_QUADS, 0, 4/* elements /);[/icode] became [icode]glDrawArrays(GL_QUADS, 0, vertices / elements */);[/icode]

Enjoy the medal,
CopyableCougar4

\o/