Skip to content
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

Do we have plan for supporting Android or iOS? And other gfx APIs? #611

Open
vinjn opened this Issue Sep 28, 2015 · 29 comments

Comments

Projects
None yet
@vinjn
Copy link

vinjn commented Sep 28, 2015

So far I am quite happy with glfw on desktop. And I would like to have a uniformed framework for mobile & desktop development.

Besides glfw for mobile, I am also thinking about glfw for other gfx APIs, like Vulkan and DirectX (creating DXGI context).
I am willing to send out PRs for some of the changes if they don't conflict the roadmap of glfw.

Thanks,
Vinjn Zhang

@dmitshur

This comment has been minimized.

Copy link
Collaborator

dmitshur commented Sep 28, 2015

There's a Go wrapper for GLFW at https://github.com/goxjs/glfw that currently supports desktop (OS X, Linux, Windows) and browsers (all modern browsers on any platform).

It is planned to at least attempt to add support for iOS and Android there too. It's not my highest priority atm but I am curious about giving it a try sometime.

Just FYI.

@vinjn

This comment has been minimized.

Copy link
Author

vinjn commented Sep 29, 2015

@shurcooL

Interesting, I am unaware of the fact that Go can run at mobile platforms.
So in order to support mobile go-glfw, are you also going to expand that capability for glfw?

@dmitshur

This comment has been minimized.

Copy link
Collaborator

dmitshur commented Sep 29, 2015

Go can target Android as of version 1.4 and iOS as of 1.5.

If I do this, I plan to do it using Go. The golang.org/x/mobile/app package already has support for mobile apps on iOS and Android. So I'd have to either find a way to build a binding on top that uses x/mobile/app but exposes a GLFW-like API. Or, if that's not possible, use internals of x/mobile/app but change the API to be GLFW-like.

I don't have immediate plans to backport those future changes from goxjs/glfw into GLFW, but if I have that working, it would be a good reference for someone interested.

However, as far as I know, Objective-C is used for iOS and Java for Android. GLFW is currently a C-only library. I'm not sure if support for iOS/Android can be added without changing that.

Note that is is all very early plans for my spare time and may not happen soon or at all.

@aleksigron

This comment has been minimized.

Copy link

aleksigron commented Sep 29, 2015

On iOS you can access C APIs like you would from C or C++. On Android you can use C APIs if the app is made with Native Development Kit (NDK).

@elmindreda

This comment has been minimized.

Copy link
Member

elmindreda commented Sep 29, 2015

So far I am quite happy with glfw on desktop. And I would like to have a uniformed framework for mobile & desktop development.

Are you sure? The current API isn't a terribly good fit for mobile. That said, I welcome mobile ports.

Besides glfw for mobile, I am also thinking about glfw for other gfx APIs, like Vulkan and DirectX (creating DXGI context).

Vulkan will be supported once it is made public. Direct3D isn't something I want to encourage, but it will become possible to use in the future.

@elmindreda elmindreda added the question label Sep 29, 2015

@vinjn

This comment has been minimized.

Copy link
Author

vinjn commented Sep 30, 2015

@elmindreda good to know.
I will send out PR for mobile and / or Direct3D later.

@Aix3D

This comment has been minimized.

Copy link

Aix3D commented Jan 22, 2016

Have you solved this issue?I have been trying to run OPENGL ES on PC for days.

@galek

This comment has been minimized.

Copy link

galek commented Jan 28, 2016

what status?

@elmindreda

This comment has been minimized.

Copy link
Member

elmindreda commented Aug 2, 2016

If someone contributes Android or iOS support then GLFW will have it. I'm too busy with the PC platforms and non-code tasks to do it in addition to everything else.

@r-lyeh-archived

This comment has been minimized.

Copy link

r-lyeh-archived commented Aug 12, 2016

You could join forces with https://github.com/brackeen/glfm as well :) @brackeen

@brackeen

This comment has been minimized.

Copy link

brackeen commented Aug 13, 2016

@r-lyeh This has been on my radar for a while, but I haven't gotten around to it yet.

There are some issues with mobile (keyboard input is inadequate on iOS, for example) but for the most part mobile support could happen.

@robindegen

This comment has been minimized.

Copy link

robindegen commented Feb 18, 2017

This would be a great great addition to glfw. This would make it absolutely perfect

@robindegen

This comment has been minimized.

Copy link

robindegen commented May 4, 2017

@SuicSoft I don't really know. But glfw support means that it would also need to handle input/touch, and window stuff (like closing etc.) properly.

@xCuri0

This comment has been minimized.

Copy link

xCuri0 commented Aug 29, 2017

Is there a documented way to add a window creation method to GLFW if so i can add Android EGL context creation support

@elmindreda

This comment has been minimized.

Copy link
Member

elmindreda commented Aug 29, 2017

@xCuri0 There isn't much internal documentation yet, I'm afraid. The null backend now (the src/null_* files) may be a good starting point, and the other backends may serve as examples of what needs to be done.

@feliwir

This comment has been minimized.

Copy link

feliwir commented Sep 11, 2017

Is there any documented way of using d3d with glfw? (Not initializing an OpenGL context for that matter)

@felselva

This comment has been minimized.

Copy link
Contributor

felselva commented Sep 11, 2017

I don't know anything about Direct 3D, but you can can use the GLFW_CLIENT_API hint to create a window with no context:

http://www.glfw.org/docs/latest/window_guide.html#window_hints_ctx

Then return the native handler of the Win32 window using the native access API:

http://www.glfw.org/docs/latest/group__native.html

If you can create your Direct 3D context (or whatever it is called in Direct 3D) from a already created window, then that's the way.

@zuck

This comment has been minimized.

Copy link

zuck commented Sep 15, 2017

I think glfm is the way to go.

As @elmindreda said, the current glfw's API doesn't fit so well for mobile, so instead of forcing it to adapt, it would be better to use a similar API but designed from scratch and optimized for mobile platforms.

If the two projects walk together, as I hope they could/would, we can have the advantage of very similar APIs (so a very clean codebase) but optimized for platforms where they run.

@xCuri0

This comment has been minimized.

Copy link

xCuri0 commented Sep 26, 2017

@elmindreda I have been working on a GLFW Android port (https://github.com/xCuri0/glfw/tree/android) but it crashes on Vulkan surface creation with SIGSEGV.EGL also gives a similar error.

Any contributions to the port are accepted.

@xCuri0

This comment has been minimized.

Copy link

xCuri0 commented Sep 27, 2017

I got a modified version for the GLFW Vulkan triangle example working on Android
screenshot_2017-09-27-21-24-09-357_com example native_activity
My GLFW port's source is in my GLFW port on the Android branch.

@elmindreda

This comment has been minimized.

Copy link
Member

elmindreda commented Sep 27, 2017

@xCuri0 That's awesome!

@xCuri0

This comment has been minimized.

Copy link

xCuri0 commented Oct 3, 2017

@elmindreda I got EGL also working.
screenshot_2017-10-03-13-34-16-834_com example native_activity

@xCuri0

This comment has been minimized.

Copy link

xCuri0 commented Oct 7, 2017

I made a pull request to add Android support #1087

@kingofoz

This comment has been minimized.

Copy link

kingofoz commented Nov 28, 2017

hello,
Is xCuri0's android port merged into the official code?

Thanks.

@xCuri0

This comment has been minimized.

Copy link

xCuri0 commented Dec 12, 2017

@kingofoz it hasn't been merged yet

@Mis012

This comment has been minimized.

Copy link

Mis012 commented Feb 15, 2018

@xCuri0 Hello, nice to see someone working on this :)
I was trying to compile your android branch, and got to a point where I can launch the simple.c example on my device. However, I am getting a strange error: Error: EGL: Failed to find a suitable EGLConfig. Does this really mean my phone is not capable of running glfw (strange...), or is the problem somewhere else? If so, how can I fix it? Thanks for help :)

@xCuri0

This comment has been minimized.

Copy link

xCuri0 commented Feb 17, 2018

@Mis012 What screen resolution and GPU does your device have.Also I think you have to change the OpenGL version in the samples from desktop GL to GL ES (unless your device supports desktop GL like Tegra)

@Mis012

This comment has been minimized.

Copy link

Mis012 commented Feb 17, 2018

@xCuri0 Display: 1280 x 720; DPI: 320; Evaluated Size: 4.6" GPU Mali-400 MP; ARM; OpenGL ES-CM 1.1; OpenGL ES 2.0
The examples don't seem to care if you have GL or GLES, unless I'm missing something. It is possible I changed it somewhere else? It definitely doesn't complain about headers or missing symbols, considering I could get it to print errors.

@xCuri0

This comment has been minimized.

Copy link

xCuri0 commented Feb 20, 2018

@Mis012 Try changing it so it uses GLES.I have an example at https://github.com/xCuri0/glfw-android-example

@elmindreda elmindreda removed the question label Dec 26, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.