Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Pull request] A necessary check when choose shader_program_ from other types to ShaderProgram::TEXTURE #7

Open
myboyhood opened this issue Nov 3, 2023 · 0 comments

Comments

@myboyhood
Copy link

Hello! Thanks for this useful code!

In textured_mesh_visual.cc file, the function void TexturedMeshVisual::setShaderProgram(ShaderProgram shader_program)
There is a Bug when shader_program_ change from other types to ShaderProgram::TEXTURE)

The reason is as following:
Since the tex_img_ need to be passed from cv_bridge in function void TexturedMeshVisual::setFromMessage in textured_mesh_visual.cc.

tex_img_ can recieve data only when (shader_program_ == ShaderProgram::TEXTURE).
Thus, when shader_program_ is initially not ShaderProgram::TEXTURE, the tex_img_ have no valid data.

suggestion
But when we choose ShaderProgram::TEXTURE in Rviz. We should check the tex_img_ firstly!

 // origin directly updateTexture
//    updateTexture(mesh_material_, tex_img_);
    // myboyhood change to check the img cols and rows
    if(!mesh_material_.isNull() && tex_img_.cols > 0 && tex_img_.rows > 0){
      updateTexture(mesh_material_, tex_img_);
    }else{
      printf("pass this Choose ShaderProgram::TEXTURE, wait for next matching!\n");
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant