Changeset c55614a in opengl-game


Ignore:
Timestamp:
May 8, 2019, 1:21:45 AM (5 years ago)
Author:
Dmitry Portnoy <dmitry.portnoy@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
e6bc0f4
Parents:
7e10667
Message:

CHange the code that copies object data into the OpenGL buffers into one generic loop and update the TODO list

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • TODO.txt

    r7e10667 rc55614a  
    33-Change the logger class to use cout instead of printf. Consider how easy variable argument support would be.
    44-Change all error messages to use the logger class so they get printed to the log file as well.
    5 -Make sure fullscreen works correctly on OSX. Check the book to see how to handle Retina Display.
    65-Add code to allow for resizing/maximizing the window
     6-Add logic to make imgui element placement depedent on the window size so it works in fullscreen
    77-Check the book's "Printing Parameters from the GL Context" to output a bunch of OpenGL context params
    88-Move some common functions into a Utils class
     
    1212-Print a warning if texture images don't have sizes of 2^x
    1313-Fix the texture-mapping code to not flip the texture upside down.
     14-Make sure fullscreen works correctly on OSX. Check the book to see how to handle Retina Display.
    1415
    1516NEW TODO
     
    3839===================================
    3940
     412. Inside populateBuffers, check for the object type and resize all buffers of that type (will eventually do this in a loop)
     42
     43STEPS TO SWITCH OFF OF GLOBAL VBOS DONE
     44========================================
     45
    40461. Remove buffer re-assignment when creating shader model groups
    41 2. Inside populateBuffers, check for the object type and resize all buffers of that type (will eventually do this in a loop)
    42473. In copyObjectData, set vertex_vbo_offset for the object type only using numPoints, not vbo_base
    43484. in renderScene, change the glDrawArrays call to use an offset of 0
  • new-game.cpp

    r7e10667 rc55614a  
    609609      (Also, I bookmarked a great explanation of this under )
    610610
     611      CHECK MY OpenGL BOOKMARK CALLED "Learn OpenGL: Advanced GLSL"
     612
    611613      No, you're misunderstanding how this works. UBO binding works exactly like texture object binding.
    612614
     
    20992101      smg->vboCapacity = shaderCounts[smg->shaderProgram] * 2;
    21002102
    2101       AttribInfo* attrib;
    2102 
    2103       if (modelGroupIt->first == TYPE_SHIP) {
    2104          attrib = &smg->attribs["vertex_position"];
    2105          glBindBuffer(GL_ARRAY_BUFFER, attrib->buffer);
    2106          glBufferData(GL_ARRAY_BUFFER, smg->vboCapacity * GLsizeof(attrib->type) * attrib->size, NULL, GL_DYNAMIC_DRAW);
    2107 
    2108          attrib = &smg->attribs["vertex_color"];
    2109          glBindBuffer(GL_ARRAY_BUFFER, attrib->buffer);
    2110          glBufferData(GL_ARRAY_BUFFER, smg->vboCapacity * GLsizeof(attrib->type) * attrib->size, NULL, GL_DYNAMIC_DRAW);
    2111 
    2112          attrib = &smg->attribs["vertex_normal"];
    2113          glBindBuffer(GL_ARRAY_BUFFER, attrib->buffer);
    2114          glBufferData(GL_ARRAY_BUFFER, smg->vboCapacity * GLsizeof(attrib->type) * attrib->size, NULL, GL_DYNAMIC_DRAW);
    2115 
    2116          attrib = &smg->attribs["ubo_index"];
    2117          glBindBuffer(GL_ARRAY_BUFFER, attrib->buffer);
    2118          glBufferData(GL_ARRAY_BUFFER, smg->vboCapacity * GLsizeof(attrib->type) * attrib->size, NULL, GL_DYNAMIC_DRAW);
    2119       } else if (modelGroupIt->first == TYPE_ASTEROID) {
    2120          attrib = &smg->attribs["vertex_position"];
    2121          glBindBuffer(GL_ARRAY_BUFFER, attrib->buffer);
    2122          glBufferData(GL_ARRAY_BUFFER, smg->vboCapacity * GLsizeof(attrib->type) * attrib->size, NULL, GL_DYNAMIC_DRAW);
    2123 
    2124          attrib = &smg->attribs["vertex_color"];
    2125          glBindBuffer(GL_ARRAY_BUFFER, attrib->buffer);
    2126          glBufferData(GL_ARRAY_BUFFER, smg->vboCapacity * GLsizeof(attrib->type) * attrib->size, NULL, GL_DYNAMIC_DRAW);
    2127 
    2128          attrib = &smg->attribs["vertex_normal"];
    2129          glBindBuffer(GL_ARRAY_BUFFER, attrib->buffer);
    2130          glBufferData(GL_ARRAY_BUFFER, smg->vboCapacity * GLsizeof(attrib->type) * attrib->size, NULL, GL_DYNAMIC_DRAW);
    2131 
    2132          attrib = &smg->attribs["ubo_index"];
    2133          glBindBuffer(GL_ARRAY_BUFFER, attrib->buffer);
    2134          glBufferData(GL_ARRAY_BUFFER, smg->vboCapacity * GLsizeof(attrib->type) * attrib->size, NULL, GL_DYNAMIC_DRAW);
    2135       } else if (modelGroupIt->first == TYPE_LASER) {
    2136          attrib = &smg->attribs["vertex_position"];
    2137          glBindBuffer(GL_ARRAY_BUFFER, attrib->buffer);
    2138          glBufferData(GL_ARRAY_BUFFER, smg->vboCapacity * GLsizeof(attrib->type) * attrib->size, NULL, GL_DYNAMIC_DRAW);
    2139 
    2140          attrib = &smg->attribs["vt"];
    2141          glBindBuffer(GL_ARRAY_BUFFER, attrib->buffer);
    2142          glBufferData(GL_ARRAY_BUFFER, smg->vboCapacity * GLsizeof(attrib->type) * attrib->size, NULL, GL_DYNAMIC_DRAW);
    2143 
    2144          attrib = &smg->attribs["ubo_index"];
    2145          glBindBuffer(GL_ARRAY_BUFFER, attrib->buffer);
    2146          glBufferData(GL_ARRAY_BUFFER, smg->vboCapacity * GLsizeof(attrib->type) * attrib->size, NULL, GL_DYNAMIC_DRAW);
    2147       } else if (modelGroupIt->first == TYPE_EXPLOSION) {
    2148          attrib = &smg->attribs["v_i"];
    2149          glBindBuffer(GL_ARRAY_BUFFER, attrib->buffer);
    2150          glBufferData(GL_ARRAY_BUFFER, smg->vboCapacity * GLsizeof(attrib->type) * attrib->size, NULL, GL_DYNAMIC_DRAW);
    2151 
    2152          attrib = &smg->attribs["start_time"];
    2153          glBindBuffer(GL_ARRAY_BUFFER, attrib->buffer);
    2154          glBufferData(GL_ARRAY_BUFFER, smg->vboCapacity * GLsizeof(attrib->type) * attrib->size, NULL, GL_DYNAMIC_DRAW);
    2155 
    2156          attrib = &smg->attribs["ubo_index"];
    2157          glBindBuffer(GL_ARRAY_BUFFER, attrib->buffer);
    2158          glBufferData(GL_ARRAY_BUFFER, smg->vboCapacity * GLsizeof(attrib->type) * attrib->size, NULL, GL_DYNAMIC_DRAW);
     2103      map<string, AttribInfo>::iterator attrIt;
     2104      for (attrIt = smg->attribs.begin(); attrIt != smg->attribs.end(); attrIt++) {
     2105         if (attrIt->second.attribType != ATTRIB_UNIFORM) {
     2106            glBindBuffer(GL_ARRAY_BUFFER, attrIt->second.buffer);
     2107            glBufferData(GL_ARRAY_BUFFER, smg->vboCapacity * GLsizeof(attrIt->second.type) * attrIt->second.size, NULL, GL_DYNAMIC_DRAW);
     2108         }
    21592109      }
    21602110   }
Note: See TracChangeset for help on using the changeset viewer.