void MainWindow::sendDataToHardware()
{
	Neumont::ShapeData cubeData = Neumont::ShapeGenerator::makeCube();
	Neumont::ShapeData torusData = Neumont::ShapeGenerator::makeTorus(12);
	Neumont::ShapeData planeData = Neumont::ShapeGenerator::makePlane(3);

	glGenBuffers(1, &theBufferID);
	glBufferData(GL_ARRAY_BUFFER, 
		cubeData.vertexBufferSize() + cubeData.indexBufferSize() +
		torusData.vertexBufferSize() + torusData.indexBufferSize() +
		planeData.vertexBufferSize() + planeData.indexBufferSize(), 0, GL_FALSE);
	
	GLintptr currentOffset = 0;
	glBufferSubData(GL_ARRAY_BUFFER, currentOffset, cubeData.vertexBufferSize(), cubeData.verts);
	currentOffset += cubeData.vertexBufferSize();
	glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, currentOffset, cubeData.indexBufferSize(), cubeData.verts);
	currentOffset += cubeData.indexBufferSize();
	glBufferSubData(GL_ARRAY_BUFFER, currentOffset, torusData.vertexBufferSize(), torusData.verts);
	currentOffset += torusData.vertexBufferSize();
	glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, currentOffset, torusData.indexBufferSize(), torusData.verts);
	currentOffset += torusData.indexBufferSize();
	glBufferSubData(GL_ARRAY_BUFFER, currentOffset, planeData.vertexBufferSize(), planeData.verts);
	currentOffset += planeData.vertexBufferSize();
	glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, currentOffset, planeData.indexBufferSize(), planeData.verts);
	currentOffset += planeData.indexBufferSize();

	cubeNumIndices = cubeData.numIndices;
	torusNumIndices = torusData.numIndices;
	planeNumIndices = planeData.numIndices;

	glBindAttribLocation(programID, cubeVertexArrayIndex, &cubeVertexArrayIndex);
	glEnableVertexAttribArray(0);
	glEnableVertexAttribArray(1);
}
void MyGLWidget::fillBuffer()
{

// arrow
	Neumont::ShapeData data = Neumont::ShapeGenerator::makeArrow();
	arrow_numIndices = data.numIndices;
	arrow_shapeData = data;

	glGenBuffers(1, &arrow_vertexBufferID);
	glGenBuffers(1, &arrow_indexBufferID);

	glBindBuffer(GL_ARRAY_BUFFER, arrow_vertexBufferID);
	glBufferData(GL_ARRAY_BUFFER, data.vertexBufferSize(), data.verts, GL_STATIC_DRAW);
	glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, arrow_indexBufferID);
	glBufferData(GL_ELEMENT_ARRAY_BUFFER, data.indexBufferSize(), data.indices, GL_STATIC_DRAW);

	data.cleanUp();

// torus
	data = Neumont::ShapeGenerator::makeTorus(50);
	torus_numIndices = data.numIndices;
	torus_shapeData = data;

	glGenBuffers(1, &torus_vertexBufferID);
	glGenBuffers(1, &torus_indexBufferID);

	glBindBuffer(GL_ARRAY_BUFFER, torus_vertexBufferID);
	glBufferData(GL_ARRAY_BUFFER, data.vertexBufferSize(), data.verts, GL_STATIC_DRAW);
	glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, torus_indexBufferID);
	glBufferData(GL_ELEMENT_ARRAY_BUFFER, data.indexBufferSize(), data.indices, GL_STATIC_DRAW);

	data.cleanUp();

// Tell GL how to read the bits (3 for the position, 4 for the color)
	glEnableVertexAttribArray(0);
	glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, Neumont::Vertex::STRIDE, 0);

	glEnableVertexAttribArray(1);
	glVertexAttribPointer(1, 4, GL_FLOAT, GL_FALSE, Neumont::Vertex::STRIDE, BUFFER_OFFSET(Neumont::Vertex::COLOR_OFFSET));
}