kettle11 / kapp

A pure Rust window and input library for Windows, Mac, and Web. (Work in progress)
Apache License 2.0
56 stars 4 forks source link

Add some flags #57

Closed lunabunn closed 3 years ago

lunabunn commented 3 years ago

Fix #28 for Windows. Things work a bit differently on Mac AFAICT (your choice of versions are more limited) and I had no idea how to implement it there, so that part's incomplete.

Also partially addresses #56. This adds an srgb flag to GlContextAttributes then uses it for context creation on Windows.

Everything seems to build? At least on Windows? But to be quite frank I'm not sure if I implemented everything correctly 😅 One area of confusion is that at least with my test project (Windows, OpenGL) even if I disable the srgb flag I still get srgb conversions so long as I run glEnable(GL_FRAMEBUFFER_SRGB). I'm pretty sure this is just my machine giving me a pixel format that supports srgb, even though I didn't ask for it, and not a mess-up on my part.

Might or might not want to flesh things out a bit more before merge, but hopefully this is a good starting point.

kettle11 commented 3 years ago

This all looks good to me!

(This PR is reminding me I should remove the iOS backend because it doesn't do anything)

But to be quite frank I'm not sure if I implemented everything correctly 😅 One area of confusion is that at least with my test project (Windows, OpenGL) even if I disable the srgb flag I still get srgb conversions so long as I run glEnable(GL_FRAMEBUFFER_SRGB). I'm pretty sure this is just my machine giving me a pixel format that supports srgb, even though I didn't ask for it, and not a mess-up on my part.

I ran into the exact same issue in the past when I used SDL (https://www.reddit.com/r/opengl/comments/da4i95/why_might_blitting_to_an_offscreen_framebuffer/). I think it's a case of a driver trying to help programmers avoid color-space mistakes, but it's obviously heavy-handed. I don't think it's worth it (at this point in time) to try to find a hack to make it work. But it's good to be aware of.

lunabunn commented 3 years ago

Cool! Then, if you're okay with merging this without MacOS support, I think we're ready for merge. Note that if this is merged, that will close #28. Might want to reopen it for MacOS..?

kettle11 commented 3 years ago

Merged! Thanks as always!