Log in or register to post comments

Display a HUD when a target is recognized

November 13, 2011 - 1:42am #1

Hello
Id like to display a HUD to my app. I tried different stuff in the ImageTargetsRenderer.java class in the onDrawFrame(GL10 gl) method, but it didnt work ...
If possible i would like to do this in the java part of the code but only if possible.
I've read the forum entry: "Overlaying Android Interface Objects" and tried this but it showed nothing...

i just want to show some text at the side of the object and probably later a button for more information.

Can someone help me with this?

ps: i'm working with the ImageTargets example.

Re: Display a HUD when a target is recognized

January 20, 2012 - 6:18am #6
cynay wrote:

I got it working.

I have a sliderDrawer with a webkit on it. When an object is detected the slider opens and shows a website to the object and the other half of the screen stays with the GLView. very nice :)

i someone is interested in something like this just ask here.

greez

Great, let me know how you did it!

Re: Display a HUD when a target is recognized

November 19, 2011 - 6:00pm #5

cynay,
im looking to do something similar to what you have done..
let me know how you did it...

Re: Display a HUD when a target is recognized

November 15, 2011 - 9:31am #4

I got it working.

I have a sliderDrawer with a webkit on it. When an object is detected the slider opens and shows a website to the object and the other half of the screen stays with the GLView. very nice :)

i someone is interested in something like this just ask here.

greez

Re: Display a HUD when a target is recognized

November 14, 2011 - 6:35pm #3

You can also take a look at the Dominoes sample, which displays a couple buttons on top of the camera view using standard Android UI elements.

- Kim

Re: Display a HUD when a target is recognized

November 14, 2011 - 3:11pm #2

This is possble... in the ImageTargets sample you set the GLSurfaceView programmatically as your content view in the activity but you can do this also at design time.

In your case you can design your layout view as an XML file using the layout editor. For this you should include a customized GLSurfaceView by extending the equal-named class. Don't forget to include the XML constructor ...(Context context, AttributeSet attrs) and to set the renderer inside the constructor or somewhere else (check how they do it in the sample). The second step is to include an overlay view (just a simple TextView or more complex) in your XML layout and place it above your custom GLSurfaceView. I'd advise to use the RelativeLayout for this and set the alignment-parameter.

Now you can pass an event from native to Java if a trackable was captured and show or hide your overlay view using the setVisibility(...) method of the view.

Be aware that there can occurr problems in yout application lifecycle concerning the drawing of the overlay as the OpenGL view hides all your content after stopping the activity.

Good luck
Vladi

Log in or register to post comments