Changeset bebfd5c in opengl-game for new-game.cpp
- Timestamp:
- Jan 22, 2019, 2:34:11 AM (6 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- ae0c7f4
- Parents:
- c5fb958
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
new-game.cpp
rc5fb958 rbebfd5c 262 262 263 263 SceneObject* objExplosion; 264 SceneObject* objFirst; // TODO: Set this, probably in populateBuffers and wherever else is appropriate. 264 265 265 266 /* … … 680 681 GLuint explosion_start_time_loc = glGetUniformLocation(explosion_sp, "explosion_start_time"); 681 682 GLuint cur_time_loc = glGetUniformLocation(explosion_sp, "cur_time"); 682 //GLuint explosion_sp_models_ub_index = glGetUniformBlockIndex(explosion_sp, "models");683 GLuint explosion_sp_models_ub_index = glGetUniformBlockIndex(explosion_sp, "models"); 683 684 684 685 … … 716 717 717 718 718 /*719 719 glUseProgram(explosion_sp); 720 720 glUniformBlockBinding(explosion_sp, explosion_sp_models_ub_index, ub_binding_point); 721 721 glBindBufferRange(GL_UNIFORM_BUFFER, ub_binding_point, ubo, 0, GL_MAX_UNIFORM_BLOCK_SIZE); 722 */723 722 724 723 … … 926 925 927 926 glUniform1f(explosion_start_time_loc, (GLfloat)glfwGetTime()); 927 928 // generic code used to change a matrix in the ubo 929 // we need to know the matrix of the first object in the ubo so we can save it and move it back 930 // after the explosion is rendered 931 // However, that should be done in the render loop, not here 932 // Here, we are already saving the explosion model mat in objExplosion->model_mat, so that is all we need 933 glBindBuffer(GL_UNIFORM_BUFFER, ubo); 934 glBufferSubData(GL_UNIFORM_BUFFER, obj.ubo_offset * sizeof(mat4), sizeof(mat4), value_ptr(obj.model_mat)); 928 935 } 929 936 }
Note:
See TracChangeset
for help on using the changeset viewer.