<div dir="ltr">Dear Robert,<br><br>I am using OSG 3.6.4-rc3.<br><br>The only built-in shaders I am using right now are the osgText shaders:<br><a href="https://github.com/openscenegraph/OpenSceneGraph/tree/master/src/osgText/shaders">https://github.com/openscenegraph/OpenSceneGraph/tree/master/src/osgText/shaders</a><br><br>These are automatically bound, when no other shaders are added to a text node.<br><br>When I don't add shaders to a geometry node, other built-in shaders seem to get active as well. I guess these are the ones from <a href="https://github.com/openscenegraph/OpenSceneGraph/tree/master/src/osg/shaders">https://github.com/openscenegraph/OpenSceneGraph/tree/master/src/osg/shaders</a>.<br><br>When I e.g. use osgText, the text will appear after starting the application. When I go to the android main screen and then go back to the app, the text nodes will become black rectangles. Somehow, osg seems to reference still the "old" objects from the context before.<br><br>Still, from the log I can verify, that shaders are compiled again after resuming to the app. <br><br>I could provide a "minimal" example if anyone is interested.<br><br>Martin.</div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Am Mo., 22. Juli 2019 um 17:24 Uhr schrieb Robert Osfield <<a href="mailto:robert.osfield@gmail.com">robert.osfield@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>HI Martin,</div><div><br></div><div>I don't have any Android experience so will defer to others on the specifics, but one question everyone will probably have is what version of the OSG are you using? When you say the OSG's "built in" shaders, which ones do you actually mean as there isn't any single set of "built in" shaders - various NodeKits provide their own shaders, and there is a osgUtil::ShaderGenVisitor that can create shaders for basic fixed function scene graph, but it's written for desktop rather that GLES2. For GLES2 applications one normally has to write your own shaders.<br></div><div><br></div><div>Robert.<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 22 Jul 2019 at 13:17, Martin Siggel <<a href="mailto:martinsiggel%2Bosg@gmail.com" target="_blank">martinsiggel+osg@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi @all,<br><br>I built a prototypical Android application based on your OSG GLES 2.0<br>example. As also users in the OSG forum pointed out, the problem with<br>this example application is, that is reinitialized everything, when<br>e.g. leaving the app, changing the screen orientation and so on.<br><br>I worked around this by just calling again<br>'setUpViewerAsEmbeddedInWindow' instead of creating everything from<br>scratch.<br><br>This seems to work pretty well, but sometimes - after a EGL context<br>loss - the shader programs are somehow lost or invalid, resulting in a<br>wrong rendering. This even happens, when using OSG's default shaders.<br><br>When debugging OSG, it seems to me, that OSG tries to clean up all GL<br>objects - including the shaders and reinitialize everything (also<br>compiling the shader objects).<br><br>Still, it happens, that the shaders get invalid sometimes and I'll get<br>the error:<br><br> s_glUseProgram:2041 GL error 0x501<br><br>Which basically means invalid program. Are the shader handled somehow<br>differently? What do I have to do, in order to properly cleanup<br>everything?<br><br>Does anyone of you have any example surviving correctly a context loss<br>e.g. due to application switch?<br><br>Here are forum entries that describe a similar problem:<br><br><a href="http://forum.openscenegraph.org/viewtopic.php?t=11270" target="_blank">http://forum.openscenegraph.org/viewtopic.php?t=11270</a><div><div><a href="http://forum.openscenegraph.org/viewtopic.php?t=14549" target="_blank">http://forum.openscenegraph.org/viewtopic.php?t=14549</a> (see point number 4.)<br><br><br>Best regards,<br>Martin</div></div></div>
_______________________________________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org" target="_blank">osg-users@lists.openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
</blockquote></div>
_______________________________________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org" target="_blank">osg-users@lists.openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature">Dr. Martin Siggel<div>Neusser Straße 257</div><div>50733 Köln </div><div>Phone: 0178 6729772</div><div><a href="mailto:martinsiggel@googlemail.com" target="_blank">martinsiggel@googlemail.com</a></div></div>