Changeset bebfd5c in opengl-game for new-game.cpp


Ignore:
Timestamp:
Jan 22, 2019, 2:34:11 AM (6 years ago)
Author:
Dmitry Portnoy <dmp1488@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
ae0c7f4
Parents:
c5fb958
Message:

WIP continued

File:
1 edited

Legend:

Unmodified
Added
Removed
  • new-game.cpp

    rc5fb958 rbebfd5c  
    262262
    263263SceneObject* objExplosion;
     264SceneObject* objFirst; // TODO: Set this, probably in populateBuffers and wherever else is appropriate.
    264265
    265266/*
     
    680681   GLuint explosion_start_time_loc = glGetUniformLocation(explosion_sp, "explosion_start_time");
    681682   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");
    683684
    684685
     
    716717
    717718
    718    /*
    719719   glUseProgram(explosion_sp);
    720720   glUniformBlockBinding(explosion_sp, explosion_sp_models_ub_index, ub_binding_point);
    721721   glBindBufferRange(GL_UNIFORM_BUFFER, ub_binding_point, ubo, 0, GL_MAX_UNIFORM_BLOCK_SIZE);
    722    */
    723722
    724723
     
    926925
    927926                  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));
    928935               }
    929936            }
Note: See TracChangeset for help on using the changeset viewer.