OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

osgText::Text problem


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
Stric
Newbie


Joined: 17 Aug 2017
Posts: 4

PostPosted: Thu Aug 17, 2017 12:23 pm    Post subject:
osgText::Text problem
Reply with quote

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. Smile

Thank you!

Cheers,
Bojan[/img][/code]
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 11154

PostPosted: Mon Aug 21, 2017 9:19 am    Post subject:
osgText::Text problem
Reply with quote

Hi Bojan,


You don't provide enough details about your OSG version or build options to know what might going on in your system.  The OSG shaders might be coming form the OSG side or in your own application, there is no way from the provided details we could guess.


Robert.





On 17 August 2017 at 13:24, Bojan Novak < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
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:
(Cool : 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. Smile

Thank you!

Cheers,
Bojan[/img][/code]

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





_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Stric
Newbie


Joined: 17 Aug 2017
Posts: 4

PostPosted: Mon Aug 21, 2017 12:56 pm    Post subject:
Reply with quote

Hi Robert,

thanks for your reply.
I am using OpenSceneGraph 3.4.0 and OpenGL/ES 2.0.

I used the following command to prepare the building process:
Code:

cmake -DCMAKE_TOOLCHAIN_FILE=/home/user/Downloads/scripts/toolchain.tegra-hf.cmake -DOPENGL_PROFILE=GLES2 -DBUILD_OSG_APPLICATIONS:BOOL=OFF -DOSG_GL1_AVAILABLE:BOOL=OFF -DOSG_GL2_AVAILABLE:BOOL=OFF -DOSG_GL3_AVAILABLE:BOOL=OFF -DOSG_GLES1_AVAILABLE:BOOL=OFF -DOSG_GLES2_AVAILABLE:BOOL=ON -DOSG_GL_DISPLAYLISTS_AVAILABLE:BOOL=OFF -DOSG_GL_FIXED_FUNCTION_AVAILABLE:BOOL=OFF -DOSG_GL_LIBRARY_STATIC:BOOL=OFF -DOSG_GL_MATRICES_AVAILABLE:BOOL=OFF -DOSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE:BOOL=OFF -DOSG_GL_VERTEX_FUNCS_AVAILABLE:BOOL=OFF -DDYNAMIC_OPENSCENEGRAPH:BOOL=ON -DDYNAMIC_OPENTHREADS:BOOL=ON -DBUILD_OSG_PLUGINS:BOOL=ON -DOPENTHREADS_SONAMES=OFF -DBUILD_OSG_EXAMPLES=OFF -DOPENGL_INCLUDE_DIR=/home/user/armcross/tegra-hf/arm-linux-gnueabihf/libc/usr/include/ -DOPENGL_egl_LIBRARY=/home/user/armcross/tegra-hf/arm-linux-gnueabihf/libc/usr/lib/libGLESv2.so -DLD_LIBRARY_PATH=/home/user/armcross/tegra-hf/arm-linux-gnueabihf/libc/lib/:/home/user/armcross/tegra-hf/arm-linux-gnueabihf/libc/usr/lib/ -DCMAKE_SYSTEM_PREFIX_PATH=/home/user/armcross/tegra-hf/arm-linux-gnueabihf/libc -DTHREADS_HAVE_PTHREAD_ARG=ON -D_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS=ON -DQT_QMAKE_EXECUTABLE=/home/user/tmp/Qt/bin/qmake -DQt5Widgets_DIR=/home/user/tmp/Qt/lib/cmake/Qt5Widgets -DQt5Gui_DIR=/home/user/tmp/Qt/lib/cmake/Qt5Gui -DQt5Core_DIR=/home/user/tmp/Qt/lib/cmake/Qt5Core -DQt5OpenGL_DIR=/home/user/tmp/Qt/lib/cmake/Qt5OpenGL -DOPENGL_gl_LIBRARY=/home/user/armcross/tegra-hf/arm-linux-gnueabihf/libc/usr/lib/libGLESv2.so -DCURL_LIBRARY=/home/user/armcross/tegra-hf/arm-linux-gnueabihf/libc/usr/lib/libcurl.so -DCURL_IS_STATIC:BOOL=OFF ../OpenSceneGraph-OpenSceneGraph-3.4.0


I'd say that the shader is coming from OSG side, because I don't set it for these text objects in my program.

Cheers,
Bojan
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 11154

PostPosted: Mon Aug 21, 2017 1:03 pm    Post subject:
osgText::Text problem
Reply with quote

Hi Bojan,


OpenSceneGraph-3.4.0 doesn't support GLES2 + osgText without users providing their own shaders.


In the OpenSceneGraph-3.4 branch (and 3.4.1-rc1) and master there are shaders provided by osgText so will work out of the box so I would recommend using one of these versions.


Robert.

------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Stric
Newbie


Joined: 17 Aug 2017
Posts: 4

PostPosted: Mon Aug 21, 2017 1:17 pm    Post subject:
Reply with quote

Hi Robert,

thank you very much, I will check it out.

Cheers,
Bojan
Back to top
View user's profile Send private message
Stric
Newbie


Joined: 17 Aug 2017
Posts: 4

PostPosted: Tue Aug 22, 2017 6:37 am    Post subject:
Reply with quote

Hi Robert,

just letting you know that I tried the OSG 3.4.1rc lib and the text labels are now visible with the OpenGL/ES indeed. Smile

Thank you very much for your advice!

Cheers,
Bojan
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts Problem compiling OSG 3.4.1 osgDB 64 bit tonyor Build system [build] 0 Thu Sep 21, 2017 12:41 am View latest post
No new posts osg::Text::setBackdropType crash with... Carlo Lanzotti - DynaD... General 2 Wed Sep 20, 2017 2:40 pm View latest post
No new posts Problem blending multiple render passes antiro42 General 5 Sat Sep 09, 2017 9:44 am View latest post
No new posts Cloning text robertosfield General 6 Fri Aug 18, 2017 8:16 am View latest post
No new posts Problem to load images robertosfield General 10 Mon Aug 07, 2017 10:36 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP