Log in or register to post comments

how to display a simple text on my imagetarget?

October 9, 2011 - 6:19pm #1

Hi all,

does anyone know how cam i display a simple text on my imagetargets?

i heard about this UILabel.. but dunno how and where to use it?
attached is the imagetargets.cpp file..:confused:

Re: how to display a simple text on my imagetarget?

October 10, 2011 - 11:11pm #8
z566788 wrote:

This question is also my problem, how can we solve it? :confused:

thanks all ^^"

Hi z566788,

Did you managed to solve the issue? ..

im still searching for the solution..

Please let me know if you got the solution...:)

Re: how to display a simple text on my imagetarget?

October 10, 2011 - 8:32pm #7

http://unity3d.com/support/documentation/Components/class-GuiText.html
http://unity3d.com/support/documentation/Components/class-TextMesh.html

- Kim

Re: how to display a simple text on my imagetarget?

October 10, 2011 - 7:04pm #6

Hi Kim,

Im using Android..

I thought Unity only can display text as a 3D object only?(and not as a common string..)

Re: how to display a simple text on my imagetarget?

October 10, 2011 - 4:00pm #5

It looks like you're trying to put Objective C code in our Android native file. Are you using Android or iOS?

See this thread for some info on the text-rendering topic: http://ar.qualcomm.at/node/2000968

We won't be able to help much with this issue. I might suggest using Unity, it will make things much simpler.

- Kim

Re: how to display a simple text on my imagetarget?

October 10, 2011 - 1:13am #4

This question is also my problem, how can we solve it? :confused:

thanks all ^^"

Re: how to display a simple text on my imagetarget?

October 9, 2011 - 8:07pm #3

Hi all,

I even tried this:

Quote:

LOGFONT logfont;

logfont.lfHeight = -12; // setup font characteristics
logfont.lfWidth = 0;
logfont.lfEscapement = 0;
logfont.lfOrientation = 0;
logfont.lfWeight = FW_NORMAL;
logfont.lfItalic = FALSE;
logfont.lfUnderline = TRUE;
logfont.lfStrikeOut = FALSE;
logfont.lfCharSet = ANSI_CHARSET;
logfont.lfOutPrecision = OUT_DEFAULT_PRECIS;
logfont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
logfont.lfQuality = PROOF_QUALITY;
logfont.lfPitchAndFamily = DEFAULT_PITCH || FF_ROMAN;
strcpy(logfont.lfFaceName,"Verdana");

hFont = CreateFontIndirect(&logfont);
SelectObject (hdc, hFont);
nFontList = glGenLists(128);
wglUseFontOutlines(hdc, 0, 128, nFontList, 0.0f, 0.5f, WGL_FONT_POLYGONS, agmf);
DeleteObject(hFont);

glListBase(nFontList);
glCallLists (11, GL_UNSIGNED_BYTE, "Text Output");

But again ndk-build throwing me the same 'Not declared error' for all the parameters there.

Quote:

$ ndk-build
Gdbserver : [arm-linux-androideabi-4.4.3] libs/armeabi/gdbserver
Gdbsetup : libs/armeabi/gdb.setup
Gdbserver : [arm-linux-androideabi-4.4.3] libs/armeabi-v7a/gdbserver
Gdbsetup : libs/armeabi-v7a/gdb.setup
Compile++ arm : ImageTargets C:/Android/qcar-android-1-0-6/samples/ImageTargetsCam/jni/ImageTargets.cpp: In function 'void Java_com_qualcomm_QCARSamples_ImageTargets_ImageTargetsRenderer_renderFrame(JNIEnv*, _jobject*)':
C:/Android/qcar-android-1-0-6/samples/ImageTargetsCam/jni/ImageTargets.cpp:173: error: 'LOGFONT' was not declared in this scope
C:/Android/qcar-android-1-0-6/samples/ImageTargetsCam/jni/ImageTargets.cpp:173: error: expected ';' before 'logfont'
C:/Android/qcar-android-1-0-6/samples/ImageTargetsCam/jni/ImageTargets.cpp:175: error: 'logfont' was not declared in this scope
C:/Android/qcar-android-1-0-6/samples/ImageTargetsCam/jni/ImageTargets.cpp:179: error: 'FW_NORMAL' was not declared in this scope
C:/Android/qcar-android-1-0-6/samples/ImageTargetsCam/jni/ImageTargets.cpp:180: error: 'FALSE' was not declared in this scope
C:/Android/qcar-android-1-0-6/samples/ImageTargetsCam/jni/ImageTargets.cpp:181: error: 'TRUE' was not declared in this scope
C:/Android/qcar-android-1-0-6/samples/ImageTargetsCam/jni/ImageTargets.cpp:183: error: 'ANSI_CHARSET' was not declared in this scope
C:/Android/qcar-android-1-0-6/samples/ImageTargetsCam/jni/ImageTargets.cpp:184: error: 'OUT_DEFAULT_PRECIS' was not declared in this scope
C:/Android/qcar-android-1-0-6/samples/ImageTargetsCam/jni/ImageTargets.cpp:185: error: 'CLIP_DEFAULT_PRECIS' was not declared in this scope
C:/Android/qcar-android-1-0-6/samples/ImageTargetsCam/jni/ImageTargets.cpp:186: error: 'PROOF_QUALITY' was not declared in this scope
C:/Android/qcar-android-1-0-6/samples/ImageTargetsCam/jni/ImageTargets.cpp:187: error: 'DEFAULT_PITCH' was not declared in this scope
C:/Android/qcar-android-1-0-6/samples/ImageTargetsCam/jni/ImageTargets.cpp:187: error: 'FF_ROMAN' was not declared in this scope
C:/Android/qcar-android-1-0-6/samples/ImageTargetsCam/jni/ImageTargets.cpp:190: error: 'hFont' was not declared in this scope
C:/Android/qcar-android-1-0-6/samples/ImageTargetsCam/jni/ImageTargets.cpp:190: error: 'CreateFontIndirect' was not declared in this scope
C:/Android/qcar-android-1-0-6/samples/ImageTargetsCam/jni/ImageTargets.cpp:191: error: 'hdc' was not declared in this scope
C:/Android/qcar-android-1-0-6/samples/ImageTargetsCam/jni/ImageTargets.cpp:191: error: 'SelectObject' was not declared in this scope
C:/Android/qcar-android-1-0-6/samples/ImageTargetsCam/jni/ImageTargets.cpp:192: error: 'nFontList' was not declared in this scope
C:/Android/qcar-android-1-0-6/samples/ImageTargetsCam/jni/ImageTargets.cpp:192: error: 'glGenLists' was not declared in this scope
C:/Android/qcar-android-1-0-6/samples/ImageTargetsCam/jni/ImageTargets.cpp:193: error: 'WGL_FONT_POLYGONS' was not declared in this scope
C:/Android/qcar-android-1-0-6/samples/ImageTargetsCam/jni/ImageTargets.cpp:193: error: 'agmf' was not declared in this scope
C:/Android/qcar-android-1-0-6/samples/ImageTargetsCam/jni/ImageTargets.cpp:193: error: 'wglUseFontOutlines' was not declared in this scope
C:/Android/qcar-android-1-0-6/samples/ImageTargetsCam/jni/ImageTargets.cpp:194: error: 'DeleteObject' was not declared in this scope
C:/Android/qcar-android-1-0-6/samples/ImageTargetsCam/jni/ImageTargets.cpp:196: error: 'glListBase' was not declared in this scope
C:/Android/qcar-android-1-0-6/samples/ImageTargetsCam/jni/ImageTargets.cpp:197: error: 'glCallLists' was not declared in this scope
make: *** [/cygdrive/c/Android/qcar-android-1-0-6/samples/ImageTargetsCam/obj/local/armeabi/objs-debug/ImageTargets/ImageTargets.o] Error 1

Re: how to display a simple text on my imagetarget?

October 9, 2011 - 7:35pm #2

does anyone know how do i use this code in my imagetargets.cpp file?

i've added this lines into my Java_com_qualcomm_QCARSamples_ImageTargets_ImageTargetsRenderer_renderFrame method.

Quote:

Font font("Verdena");
font.print("Hello World!", 50, 50, 50);

But the ndk-build giving me this error:

Quote:

$ ndk-build
Gdbserver : [arm-linux-androideabi-4.4.3] libs/armeabi/gdbserver
Gdbsetup : libs/armeabi/gdb.setup
Gdbserver : [arm-linux-androideabi-4.4.3] libs/armeabi-v7a/gdbserver
Gdbsetup : libs/armeabi-v7a/gdb.setup
Compile++ arm : ImageTargets C:/Android/qcar-android-1-0-6/samples/ImageTargetsCam/jni/ImageTargets.cpp: In function 'void Java_com_qualcomm_QCARSamples_ImageTargets_ImageTargetsRenderer_renderFrame(JNIEnv*, _jobject*)':
C:/Android/qcar-android-1-0-6/samples/ImageTargetsCam/jni/ImageTargets.cpp:219: error: 'Font' was not declared in this scope
C:/Android/qcar-android-1-0-6/samples/ImageTargetsCam/jni/ImageTargets.cpp:219: error: expected ';' before 'font'
C:/Android/qcar-android-1-0-6/samples/ImageTargetsCam/jni/ImageTargets.cpp:220: error: 'font' was not declared in this scope
make: *** [/cygdrive/c/Android/qcar-android-1-0-6/samples/ImageTargetsCam/obj/local/armeabi/objs-debug/ImageTargets/ImageTargets.o] Error 1

How do i declare the font??

Log in or register to post comments