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

Tutorial 5 Output problem: Vertex Colors in Triangle Incorrectly Interpolated #1819

Open
marauder00 opened this issue Jan 11, 2020 · 1 comment

Comments

@marauder00
Copy link

marauder00 commented Jan 11, 2020

When running the tutorial 5 code currently posted, I noticed that the colors aren't interpolating smoothly between the vertices as expected.

EDIT 1: I made some observations.. check the bottom of the post.

To recall, here's the expected output:
expected output

here's the actual output:
triangle Colors

So far, I have attempted to add smooth attributes in the shaders and change the Enum values of smoothness in the DrawParameters.

EDIT 1:
When hardcoding the color values myself, by providing a color field in the vertex buffer format,
I noticed some unexpected behaviours when setting some of the rgba values to negative, and some to 0.

For example, see what happens when you provide these colors for vertices:
Smooth interpolation: [0.0,0.0,0.0,1.0], [0.0,0.5,0.0,1.0], [0.5,0.0,0.0,1.0]
Border: [0.0,0.0,0.0,1.0], [0.0,0.5,0.0,1.0], [0.5,-0.25,0.0,1.0]

I believe negative values for colors should be clamped to 0, but it seems like this isn't the case when you interpolate between two non-black colors^.

I have tested this both on Windows 10 and Linux.
Could you please let me know what could be the cause of this?

@InnocentusLime
Copy link
Contributor

InnocentusLime commented May 15, 2020

I am getting the same result s! My guess is that the screenshot was made using an older glium version and that older version was handling rendering differently (turning on different flags, etc.) Or there are some driver shenanigans involved

P. S.
Tested on Ubuntu on Intel intergrated graphics. (Intel Corporation HD Graphics 620; Mesa 20.0.4)

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

2 participants