So I have a custom view that uses a TextureView in order to render it's content through OpenGL and JNI, which works as intented.
Now, looking at the ARCore demos (and documentation) it is posible to render Android Views using the
ViewRenderable class. But doing a quick test using my custom view, it appears that it won't work, since it wasn't made thinking in this kind of behavior...
So I have two questions here:
It is possible to use a TextureView as a custom renderable in ARCore?
If not, is there a way to have a delimited area (anchored in a given point) where I can freely make my JNI/OpenGL calls?
If someone could point me out where in the documentation (or demos) can I look out will be highly appreciated
Related
the title says it all. I want to try mediapipe specifically facemesh on android. The problem is I just want to calculate face landmarks on the background and decide more things later (like showing text of landmarks coordinates, or any other ratio). I don't want to show the opengl rendering. I tried to comment this part but still doesn't work
// glSurfaceView.setRenderData(faceMeshResult);
// glSurfaceView.requestRender();
I'm thinking of using normal view or GlSurfaceView instead of SolutionGlSurfaceView but it doesn't work. I found a similar qna How to prevent face detection bounding box from being drawn in mediapipe android
but the answer recommend me to edit compiled class and I don't think android allow me to do that. Android only allow me to extend a compiled class and use it specifically. Problem is the class I need to extend is so deep so I need to also extend all class using that class, moreover it's a C script/class and I'm not sure Android allow me to extend it easily.
Any of you find easy ways to do what I'm trying to do?
I'm building an android app in Android Studio and Kotlin that implements ARCore to render 3D models of bar charts. I need to render these models based on real time data obtained from an API, but I don't know if there is a way to modify a 3D model struture at runtime in order to make the bar chart reflect the real time data.
I'm aware of the possibility to render 3D models at runtime using Sceneform, as well as changing texture, but this doesn't seem to help me with my problem.
It may be worth considering whether you can use the animation functionality available for renderables to meet your needs - i.e. design your bar graph so that the changes you want are part of the animation design.
This will allow you use Sceneform's built in animationm support: https://developers.google.com/ar/develop/java/sceneform/animation/overview-enable-animations
Like 3D models the animations are created in advance and imported into the project when you are building it.
If your models are going to be relatively simple, you can also create simple renderables at runtime using ViewRenderable.builder() - this allows you refer to a layout or to a view created programatically where you can set the height for a bar in a graph for example. More info here: https://developers.google.com/ar/develop/java/sceneform/create-renderables
For an application i want to render things in background even when the app is not currently displayed. The official docs write to open a GLcontext via a GLSurfaceView. For not displaying graphics and rendering into another target there seems not to be a real solution.
So the Question is how to create a GL-context without GLSurfaceView in Android?
Use case: Record a video and add current time as text directly into video. For that CPU-based image-manipulation is simply to slow to be performed live. At least if the video should be also displayed while recording. OpenGL could render everything simply into a Framebuffer/Renderbuffer.
You don't have to use GLSurfaceView to do OpenGL rendering. If you look at the source code, you can see that it's only using only publicly available APIs. It is merely a convenience class that makes the most common uses of OpenGL under Android (using OpenGL to draw the content of a view) very easy. If your use case is different then you just... don't use it.
The API you use for creating contexts and rendering surfaces more directly is EGL. There are two versions of it available in the Android Java frameworks: EGL10 and EGL14. EGL10 is very old, and I would strongly recommend using EGL14.
The EGL calls are not really documented in the Android SDK documentation, but you can use the man pages on www.khronos.org to see the calls explained.
Using EGL directly, you can create a context and an off-screen rendering surface that will allow you to use OpenGL without any kind of view.
I posted complete code showing how to create a context with an off-screen rendering surface in a previous answer here: GLES10.glGetIntegerv returns 0 in Lollipop only.
Already answered here and here
I think the most simple is what is described in second link when they say :
set it's view size 1pixel&1pixel, put it visible(user cannot see it) and in OnDraw bind FBO to the main texture and render it
So you would still create a GLSurfaceView (just to get a context) but you would make it 1x1 and invisible.
Or you could use a translucent GLSurfaceView as suggested in my comment (I am not sure this will work on any device, this seems to be a bit tricky to setup).
I am looking for the best way to develop an Android app that has one component that allows the user to draw shapes, rotate them, scale them, slice them etc. (I am calling this component ActivityArea). In addition to this ActivityArea there need to be regular buttons, textViews, editViews etc. on the app.
I have explored 2 options - using libgdx and building a custom view. Both approaches appear doable. However, with libgdx, as far as I understand, all the buttons, textViews etc will also have to be created using the libgdx libraries. With this regard I have the following questions:
Is my understanding that libgdx will necessarily have to be used to render buttons and other regular android views?
Is there any way of including a libgdx powered view within an android layout?
Are there other libraries/options available that can be used to get geometric functions within an Android app?
Any help is greatly appreciated.
You can use Android UI atop LibGDX if you like. Typically for this you'd use the AndroidApplication.initializeForView(...) method to create the libgdx view and inject it into your layout.
As far as other libraries, if you doing 2d shapes and don't have to have a consistent 60fps, I'd probably just use Android's Canvas.
I want to create sth like this link using OpenGL ES 2.0. I am still a beginner, and I did the basic tutorials like drawing a square, quad etc. but still don't have a precise idea how i should do this. Should I create GLES20SurfaceView and somehow use it combined with a gallery widget (every item of the gallery would be a view - GLES20SurfaceView) or I should draw everything from scratch. Please, if someone has an experience with similar things and done sth like this, let me know, give some hints, examples, links, everything would be of great help.
Gallery is specific to a horizontal scrolling list, and wouldn't apply here.
You will want one GL surface view for your entire drawable area, not individual ones for each item.
The Carousel youtube item was created using RenderScript for best performance.
You can accomplish similar functionality entirely in Java, although performance may be an issue. I suggest writing it in Java first, then optimizing as needed for your application. Here is an Android OpenGL ES 2.0 tutorial.