Giter VIP home page Giter VIP logo

meganekko's Introduction

Meganekko

Caution: This project is no longer being actively developed. Recommended alternative solution is GearVR Framework.

Gear VR Application Framework.

The aim of the project is to create an easy to use, lightweight, application framework for Gear VR. The library enables to write an app entirely in Java.

Features

Documentation

Usage

Add a dependency in your module's build.gradle.

dependencies {
    implementation 'org.meganekkovr:meganekko:3.2.1'
    implementation 'com.android.support:support-v4:27.0.1'
    implementation 'org.joml:joml:1.9.2'
    
    // Optional for org.meganekkovr.audio_engine.AudioEngine
    implementation 'com.google.vr:sdk-audio:1.101.0'
}

Click "Sync Now".

Note: Meganekko uses multi-view rendering. This feature is not working on prior Android M devices. See also https://developer3.oculus.com/documentation/mobilesdk/latest/concepts/release/

Hello World

Meganekko app is started from subclass of MeganekkoApp.

import org.meganekkovr.MeganekkoApp;

public class MyApp extends MeganekkoApp {

    @Override
    public void init() {
        super.init();
        // Init application here
    }
}

Create VR scene with XML. XML file can be localed from xml resource. For example: res/xml/scene.xml.

<scene>
    <view src="@layout/hello_world" position="0 0 -5" />
</scene>

@layout/hello_world is normal layout file put in res/layout/hello_world.xml.

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello World!"
        android:textColor="#fff" />
</FrameLayout>

Call setSceneFromXML in MyApp.

public class MyApp extends MeganekkoApp {

    @Override
    public void init() {
        super.init();
        setSceneFromXml(R.xml.scene); // Set scene
    }
}

You have to modify AndroidManifest. Add recommended attributes and elements. See Oculus developer document.

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen">

    <!-- You have to declare to require Gear VR -->
    <meta-data
        android:name="com.samsung.android.vr.application.mode"
        android:value="vr_only" />

    <!-- Declare your App class extends MeganekkoApp -->
    <meta-data
        android:name="org.meganekkovr.App"
        android:value="org.meganekkovr.sample.MyApp"/>

    <activity
        android:name="org.meganekkovr.GearVRActivity"
        android:configChanges="orientation|screenSize|keyboard|keyboardHidden"
        android:excludeFromRecents="true"
        android:label="@string/app_name"
        android:launchMode="singleTask"
        android:screenOrientation="landscape">

        <!-- Only in debugging. Remove this when upload to Oculus Store. -->
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

    </activity>
</application>

osig file is required to launch Meganekko app in Gear VR. See Oculus developer document for more information.

Put your osig file in app/src/main/assets.

That's all! Build, Connect Galaxy device to PC, install APK, and launch app. You will see white text "Hello World!".

Build from source

Open Android Studio with this repository. Select samplev3 from module list and click Run button.

meganekko's People

Contributors

niusounds avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

meganekko's Issues

Implement Scene.onLoad, onUnload or something callback

Sceneを継承して各画面を作る時、自身がVrContext.setMainScene()に与えられたタイミングと、別のSceneがVrContext.setMainScene()に与えられたタイミング(自身がメインシーンではなくなる)を知りたい。

Picture 360

Hello,

I've an issue when I try to display a VR picture. The pic's dimensions are 12000 x 6000. And she's not really heavy, like 3Mo. I need to load heavy VR picture, 10-20Mo.
The issue is this :

A/art: art/runtime/java_vm_ext.cc:410] JNI DETECTED ERROR IN APPLICATION: JNI GetMethodID called with pending exception java.lang.OutOfMemoryError: Failed to allocate a 288000012 byte allocation with 4194304 free bytes and 253MB until OOM
A/art: art/runtime/java_vm_ext.cc:410] at java.lang.Object dalvik.system.VMRuntime.newNonMovableArray!(java.lang.Class, int) (VMRuntime.java:-2)
A/art: art/runtime/java_vm_ext.cc:410] at android.graphics.Bitmap android.graphics.BitmapFactory.nativeDecodeAsset(long, android.graphics.Rect, android.graphics.BitmapFactory$Options) (BitmapFactory.java:-2)
A/art: art/runtime/java_vm_ext.cc:410] at android.graphics.Bitmap android.graphics.BitmapFactory.decodeStream(java.io.InputStream, android.graphics.Rect, android.graphics.BitmapFactory$Options) (BitmapFactory.java:856)
A/art: art/runtime/java_vm_ext.cc:410] at android.graphics.Bitmap android.graphics.BitmapFactory.decodeResourceStream(android.content.res.Resources, android.util.TypedValue, java.io.InputStream, android.graphics.Rect, android.graphics.BitmapFactory$Options) (BitmapFactory.java:675)
A/art: art/runtime/java_vm_ext.cc:410] at android.graphics.drawable.Drawable android.graphics.drawable.Drawable.createFromResourceStream(android.content.res.Resources, android.util.TypedValue, java.io.InputStream, java.lang.String, android.graphics.BitmapFactory$Options) (Drawable.java:2228)
A/art: art/runtime/java_vm_ext.cc:410] at android.graphics.drawable.Drawable android.content.res.Resources.loadDrawableForCookie(android.util.TypedValue, int, android.content.res.Resources$Theme) (Resources.java:4215)
A/art: art/runtime/java_vm_ext.cc:410] at android.graphics.drawable.Drawable android.content.res.Resources.loadDrawable(android.util.TypedValue, int, android.content.res.Resources$Theme, boolean) (Resources.java:4089)
A/art: art/runtime/java_vm_ext.cc:410] at android.graphics.drawable.Drawable android.content.res.Resources.getDrawable(int, android.content.res.Resources$Theme, boolean) (Resources.java:2005)
A/art: art/runtime/java_vm_ext.cc:410] at android.graphics.drawable.Drawable android.content.res.Resources.getDrawable(int, android.content.res.Resources$Theme) (Resources.java:1987)
A/art: art/runtime/java_vm_ext.cc:410] at android.graphics.drawable.Drawable android.content.Context.getDrawable(int) (Context.java:464)
A/art: art/runtime/java_vm_ext.cc:410] at android.graphics.drawable.Drawable android.support.v4.content.ContextCompatApi21.getDrawable(android.content.Context, int) (ContextCompatApi21.java:26)
A/art: art/runtime/java_vm_ext.cc:410] at android.graphics.drawable.Drawable android.support.v4.content.ContextCompat.getDrawable(android.content.Context, int) (ContextCompat.java:372)
A/art: art/runtime/java_vm_ext.cc:410] at void org.meganekkovr.xml.SurfaceHandler.parse(org.meganekkovr.Entity, java.lang.String, android.content.Context) (SurfaceHandler.java:39)
A/art: art/runtime/java_vm_ext.cc:410] at void org.meganekkovr.xml.XmlAttributeParser.parse(org.meganekkovr.Entity, org.w3c.dom.Node, android.content.Context) (XmlAttributeParser.java:157)
A/art: art/runtime/java_vm_ext.cc:410] at org.meganekkovr.Entity org.meganekkovr.xml.XmlParser.parse(org.w3c.dom.Node) (XmlParser.java:140)
A/art: art/runtime/java_vm_ext.cc:410] at org.meganekkovr.Entity org.meganekkovr.xml.XmlParser.parse(org.w3c.dom.Node) (XmlParser.java:150)
A/art: art/runtime/java_vm_ext.cc:410] at org.meganekkovr.Entity org.meganekkovr.xml.XmlParser.parse(org.w3c.dom.Node) (XmlParser.java:150)
A/art: art/runtime/java_vm_ext.cc:410] at org.meganekkovr.Entity org.meganekkovr.xml.XmlParser.parseXmlResource(int) (XmlParser.java:125)
A/art: art/runtime/java_vm_ext.cc:410] at org.meganekkovr.Scene org.meganekkovr.MeganekkoApp.setSceneFromXml(int) (MeganekkoApp.java:223)
A/art: art/runtime/java_vm_ext.cc:410] at void com.lmmc.lookoom_infinite.gearvr.App.init() (App.java:26)
A/art: art/runtime/java_vm_ext.cc:410] at void org.meganekkovr.GearVRActivity.init() (GearVRActivity.java:74)
A/art: art/runtime/java_vm_ext.cc:410]
A/art: art/runtime/java_vm_ext.cc:410] in call to GetMethodID
A/art: art/runtime/java_vm_ext.cc:410] "Thread-292" prio=10 tid=10 Runnable
A/art: art/runtime/java_vm_ext.cc:410] | group="main" sCount=0 dsCount=0 obj=0x12d9c0a0 self=0xf3765500
A/art: art/runtime/java_vm_ext.cc:410] | sysTid=20850 nice=-11 cgrp=default sched=0/0 handle=0xf3399930
A/art: art/runtime/java_vm_ext.cc:410] | state=R schedstat=( 343463005 6597189 122 ) utm=28 stm=6 core=4 HZ=100
A/art: art/runtime/java_vm_ext.cc:410] | stack=0xf335b000-0xf335d000 stackSize=254KB
A/art: art/runtime/java_vm_ext.cc:410] | held mutexes= "mutator lock"(shared held)
A/art: art/runtime/java_vm_ext.cc:410] native: #00 pc 0037175f /system/lib/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+142)
A/art: art/runtime/java_vm_ext.cc:410] native: #1 pc 00350d21 /system/lib/libart.so (_ZNK3art6Thread4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEP12BacktraceMap+160)
A/art: art/runtime/java_vm_ext.cc:410] native: #2 pc 0025afdb /system/lib/libart.so (ZN3art9JavaVMExt8JniAbortEPKcS2+742)
A/art: art/runtime/java_vm_ext.cc:410] native: #3 pc 0025b6b5 /system/lib/libart.so (_ZN3art9JavaVMExt9JniAbortVEPKcS2_St9__va_list+64)
A/art: art/runtime/java_vm_ext.cc:410] native: #4 pc 000fd0a1 /system/lib/libart.so (_ZN3art11ScopedCheck6AbortFEPKcz+32)
A/art: art/runtime/java_vm_ext.cc:410] native: #5 pc 001021b5 /system/lib/libart.so (_ZN3art11ScopedCheck5CheckERNS_18ScopedObjectAccessEbPKcPNS_12JniValueTypeE.constprop.95+5072)
A/art: art/runtime/java_vm_ext.cc:410] native: #6 pc 00112dfd /system/lib/libart.so (ZN3art8CheckJNI11GetMethodIDEP7_JNIEnvP7_jclassPKcS6+396)
A/art: art/runtime/java_vm_ext.cc:410] native: #7 pc 00019850 /data/app/com.lmmc.lookoom_infinite.gearvr-2/lib/arm/libmeganekko.so (ZN3mgn14GearVRActivity13EnteredVrModeEN3OVR13ovrIntentTypeEPKcS4_S4+236)
A/art: art/runtime/java_vm_ext.cc:410] native: #8 pc 00025ee4 /data/app/com.lmmc.lookoom_infinite.gearvr-2/lib/arm/libmeganekko.so (_ZN3OVR8AppLocal11EnterVrModeEv+688)
A/art: art/runtime/java_vm_ext.cc:410] native: #9 pc 000269e0 /data/app/com.lmmc.lookoom_infinite.gearvr-2/lib/arm/libmeganekko.so (_ZN3OVR8AppLocal16VrThreadFunctionEv+480)
A/art: art/runtime/java_vm_ext.cc:410] native: #10 pc 0005ece8 /data/app/com.lmmc.lookoom_infinite.gearvr-2/lib/arm/libmeganekko.so (???)
A/art: art/runtime/java_vm_ext.cc:410] native: #11 pc 0003fc63 /system/lib/libc.so (_ZL15__pthread_startPv+30)
A/art: art/runtime/java_vm_ext.cc:410] native: #12 pc 0001a39b /system/lib/libc.so (__start_thread+6)
A/art: art/runtime/java_vm_ext.cc:410] (no managed stack frames)
A/art: art/runtime/java_vm_ext.cc:410]
A/art: art/runtime/runtime.cc:368] Runtime aborting...
A/art: art/runtime/runtime.cc:368]
A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 20850 (OVR::VrThread)

Scene.isLookingAt is wrong result if target has transform rotation or scaling

Good (?)

<scene>
    <object
        id="@+id/obj"
        layout="@layout/hello_world"
        x="2.0"
        y="-2.5"
        z="-4.8" />
</scene>
SceneObject obj = getScene().findObjectById(R.id.obj);
getScene().isLookingAt(obj); // OK (?)

Bad

<scene>
    <object
        id="@+id/obj"
        layout="@layout/hello_world"
        rotation="30 -1 0 0"
        x="2.0"
        y="-2.5"
        z="-4.8" />
</scene>
SceneObject obj = getScene().findObjectById(R.id.obj);
getScene().isLookingAt(obj); // NG!!

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.