vlang / v

Simple, fast, safe, compiled language for developing maintainable software. Compiles itself in <1s with zero library dependencies. Supports automatic C => V translation. https://vlang.io
MIT License
35.8k stars 2.16k forks source link

[gg] bg_color alpha on frame ignored #15755

Open nicolasventer opened 2 years ago

nicolasventer commented 2 years ago

V version: Current V version: V 0.3.1 0b2841d, timestamp: 2022-09-14 10:32:09 +0300
OS: Windows 11

What did you do?

In a.v:

import gg
import gx
import rand

fn main() {
    gg.new_context(
        width: 600
        height: 400
        window_title: 'Follow cursor'
        bg_color: gx.rgba(0,0,0,50) // <-- alpha does not work
        frame_fn: on_frame
    ).run()
}

fn on_frame(mut ctx &gg.Context) {
    ctx.begin()
    ctx.draw_circle_filled(rand.int() % ctx.height, rand.int() % ctx.width,
        10, gx.rgba(255, 0, 0, 255))
    ctx.end()
}

Execute: v run a.v

What did you expect to see?

I expect to see:

What did you see instead?

Whatever the value of alpha, all drawn circles immediately disappear

larpon commented 2 years ago

I don't think alpha blended window backgrounds is really supported on any platform - so we should probably ignore the alpha channel altogether.

Thanks for the report

nicolasventer commented 2 years ago

Ok thanks for the the reply.

Should I close the issue or let anyone else to close it ?

larpon commented 2 years ago

I'll let it be open - it should be fixed somehow IMO