I have android app with augmented reality by vuforia.
But:
GalaxyTab P7510 CyanogenMod 10.2 = Android 4.3.1 - camera is on background - works - see attachment 1
GalaxyS3 I9300 - stock Android 4.1.2 - shows black background :/ - see attachement 2
I have RelativeLayout with addView(), one GLSurfaceView as background, second SurfaceView with Ogre.
When I remove mRoot->renderOneFrame(), then I see camera, but not Ogre, of course.
Ogre v1-9 branch, commit Sun Sep 15 12:08:53 2013 +0300 Code cleanup
NDK r8e
Built on Linux
Here is some code:
Ogre SurfaceView rendering:
Code: Select all
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
try {
mRenderWnd->windowMovedOrResized();
mRoot->renderOneFrame();
}
catch(Ogre::RenderingAPIException ex) {
}
glDisable(GL_BLEND);
glDisable(GL_DEPTH_TEST);
Code: Select all
QCAR::State state = QCAR::Renderer::getInstance().begin();
QCAR::Renderer::getInstance().drawVideoBackground();
QCAR::Renderer::getInstance().end();
Code: Select all
viewport->setClearEveryFrame(true, Ogre::FBT_DEPTH|Ogre::FBT_STENCIL);
Code: Select all
mGlView = new ARGLSurfaceView(this);
mGlView.init(mQCARFlags, translucent, depthSize, stencilSize);
mGlView.setRenderer(mGlView);
mGlView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
mSurfaceView = new OgreSurfaceView(this);
mSurfaceView.setVisibility(View.INVISIBLE);
mMainLayout.addView(mSurfaceView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
mLoadingIndicator.bringToFront();
mSurfaceView.setVisibility(View.VISIBLE);
// then ...
mGlView.mIsActive = true;
mMainLayout.addView(mGlView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
mGlView.setVisibility(View.VISIBLE);
// then ...
QCARJNI.startCamera();
// the both Views has:
holder.setFormat(PixelFormat.TRANSLUCENT);
Roman
[UPDATE] Test GalaxyTab 10.2 stock Android 4.2 - the same black background
[SOLVED]
Okay, I have moved QCAR rendering stuff from QCAR GLSurfaceView to OGRE's SurfaceView. First QCAR begin and drawVideo, then render OGRE and QCAR end.
And everything works!!!
Thanks to OGRE!!!