Changeset 14e6918 in opengl-game
- Timestamp:
- Apr 12, 2019, 3:43:15 PM (6 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- f97e638
- Parents:
- a9d191a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
new-game.cpp
ra9d191a r14e6918 556 556 initModelGroupAttribs(modelGroups[TYPE_ASTEROID]); 557 557 558 glBindBuffer(GL_ARRAY_BUFFER, points_vbo);559 glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, NULL);560 modelGroups[TYPE_ASTEROID].attribs["vertex_position"].buffer = points_vbo;561 562 glBindBuffer(GL_ARRAY_BUFFER, colors_vbo);563 glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 0, NULL);564 modelGroups[TYPE_ASTEROID].attribs["vertex_color"].buffer = colors_vbo;565 566 glBindBuffer(GL_ARRAY_BUFFER, normals_vbo);567 glVertexAttribPointer(2, 3, GL_FLOAT, GL_FALSE, 0, NULL);568 modelGroups[TYPE_ASTEROID].attribs["vertex_normal"].buffer = normals_vbo;569 570 glBindBuffer(GL_ARRAY_BUFFER, model_mat_idx_vbo);571 glVertexAttribIPointer(3, 1, GL_UNSIGNED_INT, 0, NULL);572 modelGroups[TYPE_ASTEROID].attribs["ubo_index"].buffer = model_mat_idx_vbo;573 574 558 modelGroups[TYPE_LASER] = createModelGroup( 575 559 loadShaderProgram("./laser.vert", "./laser.frag")); … … 2295 2279 glBindBuffer(GL_ARRAY_BUFFER, attrib->buffer); 2296 2280 glBufferData(GL_ARRAY_BUFFER, smg->vboCapacity * GLsizeof(attrib->type) * attrib->size, NULL, GL_DYNAMIC_DRAW); 2281 } else if (modelGroupIt->first == TYPE_ASTEROID) { 2282 attrib = &smg->attribs["vertex_position"]; 2283 glBindBuffer(GL_ARRAY_BUFFER, attrib->buffer); 2284 glBufferData(GL_ARRAY_BUFFER, smg->vboCapacity * GLsizeof(attrib->type) * attrib->size, NULL, GL_DYNAMIC_DRAW); 2285 2286 attrib = &smg->attribs["vertex_color"]; 2287 glBindBuffer(GL_ARRAY_BUFFER, attrib->buffer); 2288 glBufferData(GL_ARRAY_BUFFER, smg->vboCapacity * GLsizeof(attrib->type) * attrib->size, NULL, GL_DYNAMIC_DRAW); 2289 2290 attrib = &smg->attribs["vertex_normal"]; 2291 glBindBuffer(GL_ARRAY_BUFFER, attrib->buffer); 2292 glBufferData(GL_ARRAY_BUFFER, smg->vboCapacity * GLsizeof(attrib->type) * attrib->size, NULL, GL_DYNAMIC_DRAW); 2293 2294 attrib = &smg->attribs["ubo_index"]; 2295 glBindBuffer(GL_ARRAY_BUFFER, attrib->buffer); 2296 glBufferData(GL_ARRAY_BUFFER, smg->vboCapacity * GLsizeof(attrib->type) * attrib->size, NULL, GL_DYNAMIC_DRAW); 2297 2297 } else if (modelGroupIt->first == TYPE_LASER) { 2298 2298 attrib = &smg->attribs["vertex_position"]; … … 2341 2341 BufferInfo* bufferInfo = &shaderBufferInfo[modelGroups[obj.type].shaderProgram]; 2342 2342 2343 if (obj.type == TYPE_SHIP || obj.type == TYPE_ LASER) {2343 if (obj.type == TYPE_SHIP || obj.type == TYPE_ASTEROID || obj.type == TYPE_LASER) { 2344 2344 obj.vertex_vbo_offset = modelGroups[obj.type].numPoints; 2345 2345 } else { … … 2564 2564 glBindVertexArray(modelGroups[TYPE_ASTEROID].vao); 2565 2565 2566 glDrawArrays(GL_TRIANGLES, shaderBufferInfo[modelGroups[TYPE_ASTEROID].shaderProgram].vbo_base, modelGroups[TYPE_ASTEROID].numPoints);2566 glDrawArrays(GL_TRIANGLES, 0, modelGroups[TYPE_ASTEROID].numPoints); 2567 2567 2568 2568 glEnable(GL_BLEND);
Note:
See TracChangeset
for help on using the changeset viewer.