0

I need to create a custom view (a 3D object view) using C++ library like OBJ-Loader.

I can use this library by setting up Android NDK in my Android Studio Java project. However, once the NDK loads the .OBJ file and creates a 3D Object, how can I show that on my Activity?

Is it possible to show the view created by NDK on a normal Java Activity? If so, how to pass that data/view to Java? I am aware of how I can pass String/Double/etc. values from NDK to my Java Activity.

Note: I am trying to avoid NativeActivity because there are other components on the activity that are much easier to do in plain old Activity.

Reference to any documentation or guide is appreciated!

ᴛʜᴇᴘᴀᴛᴇʟ
  • 4,466
  • 5
  • 39
  • 73
  • What kind of object is the view that you are creating in the C++ code. – Jim Rhodes Oct 08 '19 at 19:01
  • I haven't tried creating this because I'm not sure if it's possible to do it. I guess the bigger question I have is - is there any type of view that can work? `OBJ-Loader` is an example of C++ library but I can use a different one that allows me to create a supported object/view – ᴛʜᴇᴘᴀᴛᴇʟ Oct 08 '19 at 20:42
  • 3D views using OBJ files normally use OpenGL ES. For performance reasons NDK/JNI is used. Resources are available through your favorite search engine. – Morrison Chang Oct 08 '19 at 22:37
  • @MorrisonChang What resources are you referring to? I already have my `OBJ` file and already have a way to use NDK/JNI to load the 3D object. what I'm asking is little different - is it possible to show what NDK/JNI draws on a normal `Activity`? – ᴛʜᴇᴘᴀᴛᴇʟ Oct 08 '19 at 22:45
  • How are you rendering your OBJ file? OBJ files are just text files. The project you linked to just reads in a file and sets up a data structure in C++. No different than reading in a CSV file but does nothing about showing a bar chart of that data. See: [How to load and display .obj file in Android with OpenGL-ES 2](https://stackoverflow.com/q/41012719/295004) for a Java solution. – Morrison Chang Oct 08 '19 at 22:54

0 Answers0