Coder Social home page Coder Social logo

Comments (4)

gaborigloi avatar gaborigloi commented on June 10, 2024

I had a go at this (but not the sRGB conversion): https://github.com/gaborigloi/glium_graphics/tree/latest-graphics, this compiles with the latest piston2d-graphics.
To upgrade, most of the time I just followed what the opengl_graphics backend does.
I also updated piston-texture to the latest version.

I noticed two things:

  • The definition of alpha blending in Piston is different from alpha blending in glium for the alpha channel.
    piston2d-graphics says new_dest_alpha = src_alpha + dest_alpha, but what glium does is
    new_dest_alpha = src_alpha * src_alpha + dest_alpha * (1 - src_alpha).
    Therefore I could not use glium::Blend::alpha_blending(), had to construct the Blend manually.

  • For graphics::draw_state::Blend::Invert, I used this blending:

    new_dest_color = (ref_color - dst_color) * src_color,

    but the equation in the rustdoc of Invert is different, it says

    new_dest_color = ref_color - src_color.

Also, I'm not sure what formatting to use, I'm still new to Rust. Should I just run rustfmt to format the code, or is the current formatting ok?

from glium_graphics.

gaborigloi avatar gaborigloi commented on June 10, 2024

Opened a pull request: #112

from glium_graphics.

bvssvni avatar bvssvni commented on June 10, 2024

I think piston-graphics used the alpha equation from Gfx, but after doing some research it seems neither Glium or Gfx use the correct one. Opened PistonDevelopers/graphics#1042

from glium_graphics.

bvssvni avatar bvssvni commented on June 10, 2024

For now, we could use new_dest_alpha = src_alpha + dest_alpha.

from glium_graphics.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.