"We offer new support options and therefor the forums are now in read-only mode! Please check out our Support Center for more information." - Vuforia Engine Team

adding a home screen

I'm building an AR app based on QCAR. I want the app to work as follows. First, it shows a home screen, which has a couple of menu buttons. One of them is, for example, "Start AR". When users click the button, camera starts and AR contents are displayed. The sample applications like ImageTargets and VirtualButtons have only one activity, which does initialization stuff and shows a splashscreen image and then GLView. I'm going to make a home screen as an main activity, and when menu button is pressed, AR related activity (like VirtualButtons) will be started. If so, it seems that delay time to do initialization is long because a lot of texture images are added for my app. My question is.. Can I do initialization stuff before the home screen is displayed? If so, how? or any idea to make such an app?

The problem is that OpenGL resources (e.g. textures, models) are bound to the context that is created and destroyed with the activity.

[QUOTE=ksiva]The problem is that OpenGL resources (e.g. textures, models) are bound to the context that is created and destroyed with the activity.

It's certainly a reasonable way, but it might prove a bit tricky. The camera background image is rendered each frame by the renderFrame method, on the OpenGL thread.

As to your out-of-memory issue, make sure you are releasing any bitmaps using Bitmap.recycle(). This is a common mistake with Android GUIs. - Kim

[QUOTE=ksiva]It's certainly a reasonable way, but it might prove a bit tricky. The camera background image is rendered each frame by the renderFrame method, on the OpenGL thread.

[QUOTE=ksiva]As to your out-of-memory issue, make sure you are releasing any bitmaps using Bitmap.recycle(). This is a common mistake with Android GUIs. - Kim[/QUOTE] Thanks. I already read the post (probably your post) to recommend releasing bitmaps using bitmap.recycle().

Unfortunately I don't have any other tips, other than to release resources when you hide the menu. I suggest trying to profile the memory usage of your app. You can get some data from the DDMS perspective in Eclipse. I'm sure there are other tools to help as well, do a general web search. - Kim

[QUOTE=ksiva]It's certainly a reasonable way, but it might prove a bit tricky. The camera background image is rendered each frame by the renderFrame method, on the OpenGL thread.

Hmm, that's strange, are there any errors in the log? You may want to try using only power-of-two sized textures, if you aren't already. It's strange that the camera image only stops rendering once you've loaded all the textures.

It doesn't seem that the screen resolution is related to the problem. I just found another case with Pantech Vega Racer (IM-A760S) (480x800 px). It also shows black background and only AR objects are rendered.

Hi Kim. I found the cause of the problem. It is due to the opengl function, glBlendFunc(). My app renders 2-D AR objects with texture images that have transparent part. So I use that function. I'm a novice at opengl programming.

I think it depends on how the alpha value is represented, and whether it is pre-multiplied or not... I would do a bit more research on that one. - Kim

I have tested with a range of devices including ones that previously had the problem and others that didn't have the problem. With glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA), video background was rendered well with AR objects. But I found some strange cases.

Hi, Kim I have another issue related to the opengl blending function, glBlendFunc(). glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA) seems not be a perfect solution. I have translucent 2d image texture (texture.png).

Unfortunately I don't have too much experience with different blending modes. I've almost always used glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA). Perhaps you should figure out why your other images weren't working with that setting? - Kim

Thanks Kim. I think that glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) is the right choice if there is no issue of black video background in some devices. Hmm.. I'm not quite sure how I can resolve this issue.