Draw Text on 2D overlay

Community support forum for the ARToolKit v5.x for Android SDK.
slyon
Posts: 1
Joined: Fri Mar 24, 2017 2:57 pm

Draw Text on 2D overlay

Postby slyon » Fri Mar 24, 2017 3:06 pm

Hi i'm trying to draw some text over the camera scene on the ARNativeOSGPrj example for Android.

I'm trying to draw it in this file:
/artoolkit5/AndroidStudioProjects/ARNativeOSGProj/aRNativeOSG/src/main/jni/ARNativeOSG.cpp

I add my code after:

Code: Select all

// Add your own 2D overlays here.
// --->


I found this snippet in the ArOSG wiki:

Code: Select all

osg::Geode* textGeode = new osg::Geode();
    osgText::Text* text = new osgText::Text();
    text->setFont("tahoma.ttf");
    text->setCharacterSize(16.0f);
    text->setPosition(osg::Vec3(4, 4, 0));
    text->setAlignment(osgText::Text::LEFT_BASE_LINE);
    text->setColor(osg::Vec4(1.0f, 1.0f, 1.0f, 1.0f));
    text->setText("Your text here");
    textGeode->addDrawable(text);


Every time i try to compile i get an error of unknown identifier "osgText" .

I'm still figuring out how OSG is integrated and i'm a beginner in this kind of stuff.

What i have to edit to let it know where find osgText?
I checked osgPlugins.h but i don't know where edit and where put it.

Thank you

MrDaniel
Posts: 381
Joined: Wed Nov 18, 2015 9:07 pm

Re: Draw Text on 2D overlay

Postby MrDaniel » Sun Mar 26, 2017 12:18 pm

Hello Slyon,

This seems more like an OSG issue than ARToolkit.

There is a thread over on their forum for this issue - http://forum.openscenegraph.org/viewtopic.php?t=5684

I can't see your whole code but since you are using osg::Geode that would imply that you are not using namespaces. Therefore, would the correct call not be osg::osgText::Text* text = new osg::osgText::Text()?

amalcao
Posts: 6
Joined: Thu Jan 05, 2017 2:52 am

Re: Draw Text on 2D overlay

Postby amalcao » Thu Mar 30, 2017 5:01 pm

Make sure the header file <osgText/Text> is included before using the type osgText::Text .


Return to “ARToolKit for Android”

Who is online

Users browsing this forum: No registered users and 2 guests