Skip to content
This repository has been archived by the owner on Jul 3, 2020. It is now read-only.

Add a glutin example for Android #153

Open
wbigger opened this issue Jul 27, 2017 · 6 comments
Open

Add a glutin example for Android #153

wbigger opened this issue Jul 27, 2017 · 6 comments

Comments

@wbigger
Copy link
Contributor

wbigger commented Jul 27, 2017

I am trying to use android_glue to show something on the screen, but I am quite confused, since I cannot find any working example.

I tried to run the glutin example on top of the basic example in this repository, it compiles (wonderful!) but I get the following error at runtime:

thread 'main' panicked at 'not yet implemented', /Users/claudio/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/glutin-0.9.2/src/api/egl/mod.rs:497

The problem seems to be in the line:

let gl_window = glutin::GlWindow::new(window, context, &events_loop).unwrap();

It sounds perfectly reasonable since in Android we do not want to make a new window, but to use the already existing activity. I tried to play a bit with android_glue::get_native_window() but without success.

This is the project I am using for these tests: basic.zip

BTW, my final goal is to run Piston on Android!

@tomaka
Copy link
Contributor

tomaka commented Jul 27, 2017

This is unfortunately a known issue. It should work if you call something like context.with_gl(GlRequest::Specific(Api::OpenGlEs, (3, 0))).

Basically what's unimplemented! is detecting which OpenGL version to use.

@wbigger
Copy link
Contributor Author

wbigger commented Jul 28, 2017

It works, thanks! May I add this example to this repo?

@tomaka
Copy link
Contributor

tomaka commented Jul 28, 2017

I don't think it's worth creating a new example. The proper thing to do ultimately would be to fix the problem so that all the examples just work.

@wbigger
Copy link
Contributor Author

wbigger commented Jul 28, 2017

OK. I managed to compile the window.rs example from glutin repo within Android, but at the moment I get a black screen.

I copied test_gl_bindings.rs directly in the support module, to make it visibile to the module.

Can I contribute to fix something? I work with Rust and opengl but I am not an expert on either of them, but I'd like to help if I can.

@tomaka
Copy link
Contributor

tomaka commented Jul 28, 2017

@wbigger Try running adb logcat (adb is an utility from the Android SDK, you can also do cargo apk logcat). This will show you the logs of the Android device. See if anything is wrong.
Any interesting message will contain RustAndroidGlueStdouterr, so you can try adb logcat | grep RustAndroidGlueStdouterr.

@torkleyy
Copy link

Related: rust-windowing/glutin#861

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants