GithubHelp home page GithubHelp logo

Comments (8)

brackeen avatar brackeen commented on August 26, 2024 1

Are you aware of something in particular that requires Gradle?

Building the APK. Maybe it's possible to make an APK without gradle, but I do not know.

I think the question is: can it run as a plain executable and not an APK? I have no idea.

If you're trying to automate a test process via the command line (build, upload to device, and execute), yes, this is possible via gradle and the adb tools.

from glfm.

brackeen avatar brackeen commented on August 26, 2024

GLFM for Android doesn't require developers to write any Java code, although AFAIK you'll need to build GLFM Android apps with the gradle toolchain.
Does that answer your question?

from glfm.

headupinclouds avatar headupinclouds commented on August 26, 2024

I'm not sure 😄

I'll try to clarify.

The usual simple "hello world" console app:

#include <stdio.h>
int main(int arg, char **argv)
{
   printf ("HELLO WORLD\n");
   return 0;
}

can be compiled via the NDK and run on an Android device in /data/local/tmp using adb without the need for gradle or Java. (This is very convenient for OpenGL ES C++ unit testing directly from CMake, for example.) I was curious if the NDK provided enough hooks to create an OpenGL context for rendering entirely from native code. (I don't know enough about Android applications to know if this is possible or not.)

although AFAIK you'll need to build GLFM Android apps with the gradle toolchain

Are you aware of something in particular that requires Gradle?

I can try it out.

Thanks!

from glfm.

headupinclouds avatar headupinclouds commented on August 26, 2024

Follow up: http://stackoverflow.com/a/39820460

from glfm.

headupinclouds avatar headupinclouds commented on August 26, 2024

Building the APK. Maybe it's possible to make an APK without gradle, but I do not know.

I'm able to build and launch your Android sample with the help of the CMake android_create_apk script in the Hunter package manager (originally from Pixellight):

https://github.com/headupinclouds/glfm/blob/hunter/example/CMakeLists.txt#L43-L71

If you have any interest in this, I can make this optional, add documentation, and submit a PR.

FWIW, I'm interested in using this to automate OpenGL ES 2.0 shader testing via GTest.

I think the question is: can it run as a plain executable and not an APK? I have no idea.

For the GTest use case, I believe the main gotcha will be differences between APK and standard int main() {} return codes. I will take a look and can share what I find.

I'll go ahead and close this. Thanks.

from glfm.

brackeen avatar brackeen commented on August 26, 2024

Thanks for pointing out Hunter. I tried the branch you created, but could not create a build (errors involving the toolchain). Perhaps I can take a look later, but it's not a priority right now.

from glfm.

headupinclouds avatar headupinclouds commented on August 26, 2024

Perhaps I can take a look later, but it's not a priority right now.

Sure, here is the toolchain I tested:

$ git branch -a | grep -e "*"
* hunter
$ git status
On branch hunter
Your branch is up-to-date with 'headupinclouds/hunter'.
nothing to commit, working tree clean
$ 2>/dev/null polly.py --toolchain android-ndk-r10e-api-19-armeabi-v7a-neon --fwd GLFM_BUILD_EXAMPLE=ON --verbose --clear | tail -10
Log saved: /Users/dhirvonen/devel/glfm/_logs/polly/android-ndk-r10e-api-19-armeabi-v7a-neon/log.txt
-
Generate: 0:00:05.344082s
Build: 0:00:01.735071s
-
Total: 0:00:07.079477s
-
SUCCESS

Install APK vis adb or use Makefile launch target:

(cd _builds/android-ndk-r10e-api-19-armeabi-v7a-neon/ && make launch-GlfmExample | tail -4)
Stopping: com.example.glfmexample
Starting: Intent { cmp=com.example.glfmexample/.LoadLibraries VirtualScreenParam=Params{mDisplayId=-1, null, mFlags=0x00000000)} }
[100%] Built target launch-GlfmExample
/usr/local/Cellar/cmake/HEAD-f1b9fe5/bin/cmake -E cmake_progress_start /Users/dhirvonen/devel/glfm/_builds/android-ndk-r10e-api-19-armeabi-v7a-neon/CMakeFiles 0

This launches the app with the rainbow triangle.

glfm is very convenient. I will probably add this package to hunter in the near future and can run through more android toolchains in CI tests.

FWIW, and in case anyone else stumbles onto this, apparently you can perform off screen rendering in Android with a standard int main(int argc, char **argv){} application. glfm was very helpful for sorting through the details. Android simply requires eglCreatePbufferSurface as mentioned in this post:
https://mkonrad.net/2014/12/08/android-off-screen-rendering-using-egl-pixelbuffers.html

For iOS you can create your main() in an objective-c++ file (*.mm) and create a context directly (the iOS CMake add_executable default *.app will work):

        EAGLContext egl = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
        [EAGLContext setCurrentContext:egl];
        // do your rendering

from glfm.

headupinclouds avatar headupinclouds commented on August 26, 2024

FYI: https://github.com/ruslo/hunter/issues/808

Thanks!

from glfm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.