Skip to content

Improved setting of OpenGL colors #2111

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

Merged
merged 3 commits into from
Oct 2, 2021

Conversation

k4pran
Copy link
Collaborator

@k4pran k4pran commented Sep 29, 2021

Overview: What does this pull request change?

Motivation and Explanation: Why and how do your changes improve the library?

Fixes #2087

In migrating tests from cairo to opengl some tests were failing due to fill_color, stroke_color and their respective opacities not being set. The background_color was also always being set from config, so I made it a property to make it easier to change without changing the config.

class Test(Scene):
    def construct(self):
        self.wait()
        self.renderer.background_color = YELLOW
        self.wait()
        self.renderer.background_color = GREEN
        self.wait()

After these changes I could run the tests for color with opengl and added some new ones for fill and stroke

test.mp4

This also makes it more consistent with cairo with the exception of background-opacity. I couldn't set background opacity for opengl, and from what I can tell it isn't trivial to do.

Links to added or changed documentation pages

Further Information and Comments

Reviewer Checklist

  • The PR title is descriptive enough for the changelog, and the PR is labeled correctly
  • If applicable: newly added non-private functions and classes have a docstring including a short summary and a PARAMETERS section
  • If applicable: newly added functions and classes are tested

@k4pran k4pran added opengl Concerning the OpenGL renderer. pr:bugfix Bug fix for use in PRs solving a specific issue:bug enhancement Additions and improvements in general and removed pr:bugfix Bug fix for use in PRs solving a specific issue:bug labels Sep 29, 2021
@k4pran k4pran marked this pull request as ready for review September 29, 2021 19:24
Copy link
Member

@behackl behackl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, and thanks for adding these nice tests as well!

There is just a minor change request that I have, I've left a comment -- but otherwise I think this can be merged.

@behackl behackl changed the title Improve setting of opengl colors Improved setting of OpenGL colors Oct 2, 2021
@behackl behackl enabled auto-merge (squash) October 2, 2021 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Additions and improvements in general opengl Concerning the OpenGL renderer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setting colors and opacities in OpenGLVMobject doesn't change attributes
2 participants