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

SphereRenderer does not utilize connected transfer function #1094

Closed
Gegell opened this issue Aug 2, 2022 · 0 comments · Fixed by #1097
Closed

SphereRenderer does not utilize connected transfer function #1094

Gegell opened this issue Aug 2, 2022 · 0 comments · Fixed by #1097
Labels

Comments

@Gegell
Copy link
Contributor

Gegell commented Aug 2, 2022

Describe the bug
The SphereRenderer does not seem to bind the transfer function correctly to a texture. The fallback to the gray (/linear ramp) function still generates the expected result, however upon connecting the TF the spheres all switch to the same color (black).

To Reproduce
See attached Minimal Reproducible Example below.

Expected behavior
The particles should obtain coloring according to their scalar value and the connected transfer function, and not only default to 0.

Additional context
I did a bit of digging and happened upon following TODO in the SphereRenderer.cpp, which I suspect is responsible for the unexpected bahaviour:

bool SphereRenderer::enableTransferFunctionTexture(std::shared_ptr<glowl::GLSLProgram> prgm) {

    mmstd_gl::CallGetTransferFunctionGL* cgtf = this->get_tf_slot_.CallAs<mmstd_gl::CallGetTransferFunctionGL>();
    if ((cgtf != nullptr) && (*cgtf)(0)) {
        // TODO: how to do with unique?
        //cgtf->BindConvenience(prgm, GL_TEXTURE0, 0);
    } else {
        glEnable(GL_TEXTURE_1D);
        glActiveTexture(GL_TEXTURE0);
        glBindTexture(GL_TEXTURE_1D, this->grey_tf_);
        glUniform1i(prgm->getUniformLocation("tfTexture"), 0);
        glUniform2fv(prgm->getUniformLocation("tfRange"), 1, static_cast<GLfloat*>(this->range_.data()));
    }
    return true;
}

And here a minimal working example: sphere_renderer_ignores_tf.zip

Screenshots
Here the comparison as seen in the sample file with the transfer function connected (scalar value of particles is simply their y-value):
With TF

And without the connection:
Without TF

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant