-
Notifications
You must be signed in to change notification settings - Fork 2
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
Glium example panics on texture creation #6
Comments
That's not the issue with the 1 byte alignment, I found the issue. The I tried fixing it manually and it works let expected_row_bytes = bitmap.width() * 4;
let got_row_bytes = bitmap.row_bytes();
let data = if expected_row_bytes != got_row_bytes {
// there is some padding after each row, fix it manually
let mut new_pixels = Vec::with_capacity(
bitmap.height() as usize * expected_row_bytes as usize,
);
for row in bitmap_pixels.chunks(got_row_bytes as usize) {
new_pixels.extend_from_slice(&row[..expected_row_bytes as usize]);
}
Cow::Owned(new_pixels)
} else {
Cow::Borrowed(bitmap_pixels)
}; I'll see what glium has to offer for this. Thanks for reporting this, probably some regression after some update, but it could have happened at any point, the |
We need to use I'll probably add the above fix as a hotfix and wait for glium to fix it or implement it ourselves later on |
Nice pickup @Amjad50! I'm not too familiar with |
Interesting idea. We can use And then use the enum value of Using raw number value for |
Nice find!! Yeah, that seems like a good short term solution. |
Got a bit busy last week. But ... Update, after looking a bit around, I didn't notice this but its not easy to call gl functions that modify context used by glium, since glium manages its own textures, so at least for now using opengl functions directly needs manual management for textures and maybe other stuff as well. I'll quickly just use the manual pixels copy for now and create glium issue today for future fix |
Hey there!
When I try running the
glium
example, I get the following panic:I'm not much of an OpenGL person, but taking a quick look at the OpenGL implementation of
GPUDriver
, it looks like the bitmaps coming from Ultralight are 1 byte aligned; which is a little odd (and undocumented!):https://github.com/ultralight-ux/AppCore/blob/5e9d9e2c8c288e2890635c76aac42f91c02968c3/src/linux/gl/GPUDriverGL.cpp#L210
The text was updated successfully, but these errors were encountered: