Skip to content

Commit

Permalink
gl_panorama: make Coverity happy
Browse files Browse the repository at this point in the history
Wasn't really incorrect, because the front & back textures were only
accessed by the reader & writer thread respectively.
  • Loading branch information
mpiatka committed Feb 28, 2024
1 parent d0ff9de commit 7d9608d
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/video_display/opengl_panorama.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,26 +105,32 @@ void PanoramaScene::render(int width, int height, const glm::mat4& pvMat){
pvLoc = glGetUniformLocation(program.get(), "pv_mat");
glUniformMatrix4fv(pvLoc, 1, GL_FALSE, glm::value_ptr(pvMat));

GLuint tex_id;
{//lock
std::lock_guard<std::mutex> lock(tex_mut);
if(tex.is_new_front_available()){
tex.swap_front();
}
tex_id = tex.get_front().get();
}

glBindTexture(GL_TEXTURE_2D, tex.get_front().get());
glBindTexture(GL_TEXTURE_2D, tex_id);
model.render();
}

void PanoramaScene::put_frame(video_frame *f, bool pbo_frame){
PROFILE_FUNC;

Texture& back_texture = tex.get_back();
Texture *back_texture;
{
std::lock_guard<std::mutex> lock(tex_mut);
back_texture = &tex.get_back();
}

uploader.attach_dst_texture(&back_texture);
uploader.attach_dst_texture(back_texture);
uploader.put_frame(f, pbo_frame);

glBindTexture(GL_TEXTURE_2D, back_texture.get());
glBindTexture(GL_TEXTURE_2D, back_texture->get());
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);

glFinish();
Expand Down

0 comments on commit 7d9608d

Please sign in to comment.