Changeset c55614a in opengl-game
- Timestamp:
- May 8, 2019, 1:21:45 AM (6 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- e6bc0f4
- Parents:
- 7e10667
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TODO.txt
r7e10667 rc55614a 3 3 -Change the logger class to use cout instead of printf. Consider how easy variable argument support would be. 4 4 -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.6 5 -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 7 7 -Check the book's "Printing Parameters from the GL Context" to output a bunch of OpenGL context params 8 8 -Move some common functions into a Utils class … … 12 12 -Print a warning if texture images don't have sizes of 2^x 13 13 -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. 14 15 15 16 NEW TODO … … 38 39 =================================== 39 40 41 2. Inside populateBuffers, check for the object type and resize all buffers of that type (will eventually do this in a loop) 42 43 STEPS TO SWITCH OFF OF GLOBAL VBOS DONE 44 ======================================== 45 40 46 1. 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)42 47 3. In copyObjectData, set vertex_vbo_offset for the object type only using numPoints, not vbo_base 43 48 4. in renderScene, change the glDrawArrays call to use an offset of 0 -
new-game.cpp
r7e10667 rc55614a 609 609 (Also, I bookmarked a great explanation of this under ) 610 610 611 CHECK MY OpenGL BOOKMARK CALLED "Learn OpenGL: Advanced GLSL" 612 611 613 No, you're misunderstanding how this works. UBO binding works exactly like texture object binding. 612 614 … … 2099 2101 smg->vboCapacity = shaderCounts[smg->shaderProgram] * 2; 2100 2102 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 } 2159 2109 } 2160 2110 }
Note:
See TracChangeset
for help on using the changeset viewer.