[osg-users] osgText::Text problem

Bojan Novak bojan at lxnav.com
Thu Aug 17 05:24:04 PDT 2017


Hi,

I recently ran into a problem regarding osgText::Text class. I generate a text label as follows:

Code:

        ref_ptr<osgText::Text> psText = new osgText::Text;
        psText->setText("Some text");
        psText->setDrawMode(osgText::Text::TEXT);
        psText->setAxisAlignment(osgText::Text::XY_PLANE);
        psText->setCharacterSizeMode(osgText::Text::SCREEN_COORDS);
        psText->setCharacterSize(40));
        psText->setFont("font/Roboto-Regular.ttf");
        psText->setBackdropType(osgText::Text::OUTLINE);
        psText->setBackdropColor(Vec4(0.0f, 0.0f, 0.0f, 1.0f));
        Vec3 vPos = convertFromPolar(p.lon(), p.lat(), p.elev() + 100);
        psText->setPosition(vPos);
        psText->setColor(Vec4(0.99, 0.6, 0.95, 1.0));
        psText->setAutoRotateToScreen(true);

        m_psGeode->addDrawable(psText.get());




On my Ubuntu Linux laptop, this runs well and I can see the text label on the screen.
But when I compile the same application for an ARMv7 processor (with OpenGL/ES) and run it there, I get the following output messages on the console:

Code:

VERTEX glCompileShader "" FAILED
VERTEX Shader "" infolog:
(8) : error C7506: OpenGL/ES does not define the global variable gl_FrontColor

FRAGMENT glCompileShader "" FAILED
FRAGMENT Shader "" infolog:
(4) : error C7573: OpenGL/ES requires precision specifier on float types
(5) : error C7573: OpenGL/ES requires precision specifier on float types
(6) : error C7506: OpenGL/ES does not define the global variable gl_Color

glLinkProgram "" FAILED




And in this case, the text label does not appear on the screen.

Reading the error messages, my guess is that the shader generated to show these labels is not compatible with OpenGL/ES. Is it possible to find out the source code of the vertex and fragment shaders that get generated in this case? Or even better, what shaders should I use for the OpenGL/ES to show text labels? 

BTW, before someone tells me to check if the font file exists, it does, I double checked it and debug messages also confirm that. :)

Thank you!

Cheers,
Bojan[/img][/code]

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=71432#71432







More information about the osg-users mailing list