Index: TODO.txt
===================================================================
--- TODO.txt	(revision c4c205e95f423fdac631754ec14dc962e570370c)
+++ TODO.txt	(revision a9d191a7666a8569c85ce19eda91b79ff14cef4c)
@@ -16,5 +16,4 @@
 ==========
 -Unbind buffers (by binding to 0) once I'm done using them. This will help catch errors faster where I'm using a different buffer than I expect.
--Show the fps in a gui component instead of printing it to the console
 
 NEW DONE
@@ -22,9 +21,9 @@
 -Move buffer memory allocation code into populateBuffers()
 -Go through the large design comment blocks and clean them up. Turn them into documentation for the code that's been written since I wrote the designs.
+-Show the fps in a gui component instead of printing it to the console
 
 MAJOR TASKS TODO
 ==================
 -Figure out why rendering doesn't work on the Windows laptop
--Implement lasers
 
 MAJOR TASKS DONE
@@ -34,2 +33,11 @@
   -I don't think ImGui would work with SFML
   -When the time comes, maybe just try using the networking and audio components of SFML
+-Implement lasers
+
+STEPS TO SWITCH OFF OF GLOBAL VBOS
+===================================
+
+1. Remove buffer re-assignment when creating shader model groups
+2. Inside populateBuffers, check for the object type and resize all buffers of that type (will eventually do this in a loop)
+3. In copyObjectData, set vertex_vbo_offset for the object type only using numPoints, not vbo_base
+4. in renderScene, change the glDrawArrays call to use an offset of 0
Index: new-game.cpp
===================================================================
--- new-game.cpp	(revision c4c205e95f423fdac631754ec14dc962e570370c)
+++ new-game.cpp	(revision a9d191a7666a8569c85ce19eda91b79ff14cef4c)
@@ -261,4 +261,5 @@
 void renderSceneGui(map<string, vector<UIValue>> valueLists);
 
+void initGuiValueLists(map<string, vector<UIValue>> valueLists);
 void renderGuiValueList(vector<UIValue>& values);
 
@@ -308,4 +309,6 @@
 SceneObject* objExplosion;
 SceneObject* objFirst;
+
+map<string, vector<UIValue>> valueLists;
 
 /*
@@ -589,16 +592,4 @@
    initModelGroupAttribs(modelGroups[TYPE_LASER]);
 
-   glBindBuffer(GL_ARRAY_BUFFER, points_vbo);
-   glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, NULL);
-   modelGroups[TYPE_LASER].attribs["vertex_position"].buffer = points_vbo;
-
-   glBindBuffer(GL_ARRAY_BUFFER, texcoords_vbo);
-   glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, NULL);
-   modelGroups[TYPE_LASER].attribs["vt"].buffer = texcoords_vbo;
-
-   glBindBuffer(GL_ARRAY_BUFFER, model_mat_idx_vbo);
-   glVertexAttribIPointer(2, 1, GL_UNSIGNED_INT, 0, NULL);
-   modelGroups[TYPE_LASER].attribs["ubo_index"].buffer = model_mat_idx_vbo;
-
    modelGroups[TYPE_EXPLOSION] = createModelGroup(
       loadShaderProgram("./explosion.vert", "./explosion.frag"));
@@ -606,6 +597,6 @@
 
    // The last parameter (offset) is only used for populating the buffers since the distance
-   // between each item is needed there. However, that code isn't run for explosions right now anyway,
-   // so I may as well pass in 0 here.
+   // between each item is needed there. However, the explosion vbos are populated using different
+   // code anyway and don't use that argument, so I may as well pass in 0 here.
    defineModelGroupAttrib(modelGroups[TYPE_EXPLOSION], "v_i", ATTRIB_POINT_VARYING,
       3, GL_FLOAT, 0);
@@ -783,13 +774,8 @@
    State curState = STATE_MAIN_MENU;
 
-   map<string, vector<UIValue>> valueLists;
-
-   valueLists["stats value list"] = vector<UIValue>();
+   initGuiValueLists(valueLists);
+
    valueLists["stats value list"].push_back(UIValue(UIVALUE_INT, "Score", &score));
    valueLists["stats value list"].push_back(UIValue(UIVALUE_DOUBLE, "FPS", &fps));
-
-   valueLists["debug value list"] = vector<UIValue>();
-
-   //valueLists["debug value list"].push_back(UIValue(UIVALUE_INT, "Buffer offset", &bufferOffset));
 
    while (!glfwWindowShouldClose(window) && isRunning) {
@@ -2291,23 +2277,34 @@
       smg->vboCapacity = shaderCounts[smg->shaderProgram] * 2;
 
+      AttribInfo* attrib;
+
       if (modelGroupIt->first == TYPE_SHIP) {
-         int numPoints = shaderCounts[smg->shaderProgram];
-         AttribInfo* attrib;
-
          attrib = &smg->attribs["vertex_position"];
          glBindBuffer(GL_ARRAY_BUFFER, attrib->buffer);
-         glBufferData(GL_ARRAY_BUFFER, numPoints * GLsizeof(attrib->type) * attrib->size, NULL, GL_DYNAMIC_DRAW);
+         glBufferData(GL_ARRAY_BUFFER, smg->vboCapacity * GLsizeof(attrib->type) * attrib->size, NULL, GL_DYNAMIC_DRAW);
 
          attrib = &smg->attribs["vertex_color"];
          glBindBuffer(GL_ARRAY_BUFFER, attrib->buffer);
-         glBufferData(GL_ARRAY_BUFFER, numPoints * GLsizeof(attrib->type) * attrib->size, NULL, GL_DYNAMIC_DRAW);
+         glBufferData(GL_ARRAY_BUFFER, smg->vboCapacity * GLsizeof(attrib->type) * attrib->size, NULL, GL_DYNAMIC_DRAW);
 
          attrib = &smg->attribs["vertex_normal"];
          glBindBuffer(GL_ARRAY_BUFFER, attrib->buffer);
-         glBufferData(GL_ARRAY_BUFFER, numPoints * GLsizeof(attrib->type) * attrib->size, NULL, GL_DYNAMIC_DRAW);
+         glBufferData(GL_ARRAY_BUFFER, smg->vboCapacity * GLsizeof(attrib->type) * attrib->size, NULL, GL_DYNAMIC_DRAW);
 
          attrib = &smg->attribs["ubo_index"];
          glBindBuffer(GL_ARRAY_BUFFER, attrib->buffer);
-         glBufferData(GL_ARRAY_BUFFER, numPoints * GLsizeof(attrib->type) * attrib->size, NULL, GL_DYNAMIC_DRAW);
+         glBufferData(GL_ARRAY_BUFFER, smg->vboCapacity * GLsizeof(attrib->type) * attrib->size, NULL, GL_DYNAMIC_DRAW);
+      } else if (modelGroupIt->first == TYPE_LASER) {
+         attrib = &smg->attribs["vertex_position"];
+         glBindBuffer(GL_ARRAY_BUFFER, attrib->buffer);
+         glBufferData(GL_ARRAY_BUFFER, smg->vboCapacity * GLsizeof(attrib->type) * attrib->size, NULL, GL_DYNAMIC_DRAW);
+
+         attrib = &smg->attribs["vt"];
+         glBindBuffer(GL_ARRAY_BUFFER, attrib->buffer);
+         glBufferData(GL_ARRAY_BUFFER, smg->vboCapacity * GLsizeof(attrib->type) * attrib->size, NULL, GL_DYNAMIC_DRAW);
+
+         attrib = &smg->attribs["ubo_index"];
+         glBindBuffer(GL_ARRAY_BUFFER, attrib->buffer);
+         glBufferData(GL_ARRAY_BUFFER, smg->vboCapacity * GLsizeof(attrib->type) * attrib->size, NULL, GL_DYNAMIC_DRAW);
       }
    }
@@ -2344,5 +2341,5 @@
    BufferInfo* bufferInfo = &shaderBufferInfo[modelGroups[obj.type].shaderProgram];
 
-   if (obj.type == TYPE_SHIP) {
+   if (obj.type == TYPE_SHIP || obj.type == TYPE_LASER) {
       obj.vertex_vbo_offset = modelGroups[obj.type].numPoints;
    } else {
@@ -2574,5 +2571,5 @@
    glBindVertexArray(modelGroups[TYPE_LASER].vao);
 
-   glDrawArrays(GL_TRIANGLES, shaderBufferInfo[modelGroups[TYPE_LASER].shaderProgram].vbo_base, modelGroups[TYPE_LASER].numPoints);
+   glDrawArrays(GL_TRIANGLES, 0, modelGroups[TYPE_LASER].numPoints);
 
    glUseProgram(modelGroups[TYPE_EXPLOSION].shaderProgram);
@@ -2699,4 +2696,9 @@
 }
 
+void initGuiValueLists(map<string, vector<UIValue>> valueLists) {
+   valueLists["stats value list"] = vector<UIValue>();
+   valueLists["debug value list"] = vector<UIValue>();
+}
+
 void renderGuiValueList(vector<UIValue>& values) {
    float maxWidth = 0.0f;
