How to setup a renderer with fplbase_stdlib

32 views
Skip to first unread message

Aldo Culquicondor

unread,
Sep 16, 2017, 5:46:34 PM9/16/17
to fplbaselib
I'm trying to use mix gvr with fplbase. So far, I was able to setup a context with gvr and draw with native gl functions. Now I want to start using fplbase. My first question is how to setup the renderer. Calling Initialize triggers undefined references to fplbase::SetAttributes, fplbase::UnSetAttributes, fplbase::AndroidGetContextClientVersion and AndroidInitGl3Functions.

This is my Android.mk file:
LOCAL_PATH := $(call my-dir)/..

FPLUTIL_DIR
:= $(LOCAL_PATH)/../dependencies/fplutil

include $
(FPLUTIL_DIR)/buildutil/android_common.mk
DEPENDENCIES_GVR_SDK_DIR
:= $(LOCAL_PATH)/../dependencies/gvr-android-sdk

include $
(DEPENDENCIES_FLATBUFFERS_DIR)/android/jni/include.mk

include $
(CLEAR_VARS)
LOCAL_MODULE
:= vraze_jni
LOCAL_C_INCLUDES
:= \
  $
(DEPENDENCIES_FPLUTIL_DIR)/libfplutil/include \
  $
(DEPENDENCIES_FPLBASE_DIR)/include \
  $
(DEPENDENCIES_MATHFU_DIR)/include \
  $
(DEPENDENCIES_GVR_SDK_DIR)/libraries/headers \
  $
(LOCAL_PATH)/src

LOCAL_SRC_FILES
:= \
  src
/main/cpp/vraze_jni.cpp \
  src
/main/cpp/vraze_app.cpp

LOCAL_STATIC_LIBRARIES
:= \
  libfplbase_stdlib

LOCAL_LDLIBS
:= -lGLESv2 -llog -lz -lEGL -landroid \
 
-L$(LOCAL_PATH)/../libraries/jni/armeabi-v7a \
 
-lgvr

include $
(BUILD_SHARED_LIBRARY)

$
(call import-add-path,$(DEPENDENCIES_FLATBUFFERS_DIR)/..)
$
(call import-add-path,$(DEPENDENCIES_FPLBASE_DIR)/..)
$
(call import-add-path,$(DEPENDENCIES_MATHFU_DIR)/..)

$
(call import-module,flatbuffers/android/jni)
$
(call import-module,fplbase/jni)
$
(call import-module,mathfu/jni)


I wasn't able to find the appropriate docs.

Thanks.

Aldo Culquicondor

unread,
Sep 16, 2017, 7:42:43 PM9/16/17
to fplbaselib
Alternatively, I tried using regular fplbase and tried to setup a renderer after GvrApi::InitializeGl hoping it wouldn't create a new context.
I had to add src/render_utils_gl.cpp to FPLBASE_COMMON_SRC_FILES on fplbase's Android.mk and I had to create a main.cc file FPL_main on which I just return 0 (I don't see why I would have to do this). In any case, it finally compiled but I got a crash. The stack is this one:
* thread #24, name = 'GLThread 7150', stop reason = signal SIGABRT
  * frame #0: 0xf50cfba8 libc.so`tgkill + 12
    frame #1: 0xf50cd326 libc.so`pthread_kill + 38
    frame #2: 0xf50a357c libc.so`raise + 14
    frame #3: 0xf509f2a4 libc.so`__libc_android_abort + 38
    frame #4: 0xf509d30c libc.so`abort + 8
    frame #5: 0xf4648abc libart.so`art::Runtime::Abort(char const*) + 332
    frame #6: 0xf43e3208 libart.so`art::LogMessage::~LogMessage() + 1136
    frame #7: 0xf4567f80 libart.so`art::JavaVMExt::JniAbort(char const*, char const*) + 1668
    frame #8: 0xf4568172 libart.so`art::JavaVMExt::JniAbortV(char const*, char const*, std::__va_list) + 62
    frame #9: 0xf43f8bae libart.so`art::ScopedCheck::AbortF(char const*, ...) + 50
    frame #10: 0xf43f838e libart.so`art::ScopedCheck::CheckInstance(art::ScopedObjectAccess&, art::ScopedCheck::InstanceKind, _jobject*, bool) + 358
    frame #11: 0xf43f7856 libart.so`art::ScopedCheck::CheckPossibleHeapValue(art::ScopedObjectAccess&, char, art::JniValueType) + 194
    frame #12: 0xf43f6c8e libart.so`art::ScopedCheck::Check(art::ScopedObjectAccess&, bool, char const*, art::JniValueType*) + 806
    frame #13: 0xf43fa14c libart.so`art::CheckJNI::GetMethodIDInternal(char const*, _JNIEnv*, _jclass*, char const*, char const*, bool) + 468
    frame #14: 0xf43f1548 libart.so`art::CheckJNI::GetStaticMethodID(_JNIEnv*, _jclass*, char const*, char const*) + 28
    frame #15: 0xdb33728c libvraze_jni.so`Android_JNI_GetTouchDeviceIds + 96
    frame #16: 0xdb3a0abc libvraze_jni.so`Android_InitTouch + 36
    frame #17: 0xdb3a13bc libvraze_jni.so
    frame #18: 0xdb39740c libvraze_jni.so`SDL_VideoInit_REAL + 952
    frame #19: 0xdb3a2554 libvraze_jni.so`SDL_InitSubSystem_REAL + 308
    frame #20: 0xdb3a28e8 libvraze_jni.so`SDL_Init_REAL + 24
    frame #21: 0xdb3382b4 libvraze_jni.so`SDL_Init + 48
    frame #22: 0xdb2cbf8c libvraze_jni.so`fplbase::Environment::Initialize(mathfu::Vector<int, 2> const&, char const*, fplbase::WindowMode) + 64
    frame #23: 0xdb2b7d4c libvraze_jni.so`fplbase::RendererBase::Initialize(mathfu::Vector<int, 2> const&, char const*, fplbase::WindowMode) + 72
    frame #24: 0xdb2b3daa libvraze_jni.so`fplbase::Renderer::Initialize(mathfu::Vector<int, 2> const&, char const*, fplbase::WindowMode) + 52
    frame #25: 0xdb2b3932 libvraze_jni.so`VRazeApp::OnSurfaceCreated() + 70

I would really appreciate some help. What I want to achieve is the ability to compile shaders, load meshes, textures and so on.

Thank you

Wouter van Oortmerssen

unread,
Sep 18, 2017, 1:20:49 PM9/18/17
to Aldo Culquicondor, fplbaselib
I assume you fixed your build errors with https://github.com/google/fplbase/pull/6

We've had plans to upgrade FPLBase to support the GVR sdk out of the box, but haven't gotten around to it. There should still be support to use the old Java based VR SDK instead. It may be possible to ignore it and just use the GVR SDK directly, but we haven't tried this.

I have not seen that stack-trace before. Looks like something internally to SDL is going wrong.

--
You received this message because you are subscribed to the Google Groups "fplbaselib" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fplbaselib+unsubscribe@googlegroups.com.
To post to this group, send email to fplba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fplbaselib/68be752e-0eec-4059-8865-185446d322ea%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Aldo Culquicondor

unread,
Sep 18, 2017, 1:29:24 PM9/18/17
to fplbaselib
Yes, I solved the building with fplbase_stdlib.
I'm targeting Daydream, so I can't use the older GVR.
So far I got it working with an additional hack https://github.com/google/fplbase/issues/7 :)
To unsubscribe from this group and stop receiving emails from it, send an email to fplbaselib+...@googlegroups.com.

To post to this group, send email to fplba...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages