I am trying to use gfx on the Android platform, but one problem after another, finally, I met the first gfx problem. My codes as the following
let el = EventLoop::new();
el.run(move |event, el, control_flow| {
*control_flow = ControlFlow::Wait;
match event {
Event::Resumed => unsafe {
log::info!("window resumed");
let window_builder = WindowBuilder::new().with_title("hello");
let window = ContextBuilder::new()
.build_windowed(window_builder, el)
.unwrap()
.make_current()
.unwrap();
log::info!("windows created");
let surface_extent = Extent2D {
width: 1024,
height: 768,
};
// The `instance` is an entry point to the graphics API. The `1` in the
// call is a version number - we don't care about that for now.
//
// The `surface` is an abstraction of the OS window we're drawing into.
// In `gfx`, it also manages the swap chain, which is a chain of
// multiple images for us to render to. While one is being displayed, we
// can write to another one - and then swap them, hence the name.
//
// The `adapter` represents a physical device. A graphics card for example.
// The host may have more than one, but below, we just take the first.
let (instance, surface, adapter) = {
let instance =
backend::Instance::create(APP_NAME, 1).expect("Backend not supported");
let surface = instance
.create_surface(window.window())
.expect("Failed to create surface for window");
let adapter = instance.enumerate_adapters().remove(0);
(instance, surface, adapter)
};
Short info header:
I am trying to use gfx on the Android platform, but one problem after another, finally, I met the first gfx problem. My codes as the following
I also tried to use gfx-backend-gl but create_surface also failed with 'BadAlloc'.