-
Notifications
You must be signed in to change notification settings - Fork 31
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
Fix headless screenshot rendering (partially) #14
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried pulling in this branch and taking a screenshot.
But i just ended up getting a black screen.
Hmm - what OS? And do you mean 'screen' or the resulting PNG image? |
I'm using Arch Linux , a.png is just a black image. |
This is what happens when i run it on an RHEL amazon aws instance which is where i'm trying to do headless rendering . |
I did some tests - on macOS everything works fine, on Ubuntu (16.04 Desktop) I first got the same error about Alternative approach I've successfully used on a different project you might try to adapt to RHEL: $ sudo apt-get install xvfb # depends on mesa, so it doesn't have to be installed explicitly
$ xvfb-run --auto-servernum --server-args="-screen 0 640x480x24" \
cargo run -- Box.glb --screenshot b.png This should work with the current 'faux' headless mode. Perhaps I'll add a switch to choose between 'real' and 'faux' headless mode. |
I saw a similar issue opened on glutin, I can try the xfvb but i need this to work on an AWS Lambda; but Lambda doesn't have xfvb preinstalled . I'll see what i can do . Thank you for all your help. |
You definitely need |
xvfb-run --auto-servernum --server-args="-screen 0 640x480x24" -e logs.log target/debug/gltf-viewer models/DamagedHelmet.gltf --screenshot a.png -w 640 -h 480 Even xvfb has issues with the faux headless mode . I'll give this a few more go's |
Today I had some time do to my own experiments on AWS (Ubuntu 16.04 instance) - I fixed the above error by installing Then I started to put everything in Docker -> develop...headless_docker |
I'll have a look at this @bwasty. Thank you . |
Some notes from further experiments:
(from here) Next step: generate more debug output with these queries: https://www.khronos.org/opengl/wiki/OpenGL_Context#Context_information_queries |
I've decided to merge this as it is since I've made quite some progress on the docker branch. |
Should solve #12.
Current state: Works fine on macOS, on Linux the resulting image is always black.
TODOs:
[ ] Fix Linux (black/transparent image - issue in(postponed)glutin
?)[ ] Test on Windows(postponed)