<div dir="ltr"><div><div>Hi,<br><br></div>I am not sure if the original poster is aware of this, the osgvertexattributes osg sample code is able to generate shaders from fixed function pipeline state sets in the scene graph and applies these shaders to the geometry.<br><br><a href="http://trac.openscenegraph.org/projects/osg//browser/OpenSceneGraph/trunk/examples/osgvertexattributes/osgvertexattributes.cpp">http://trac.openscenegraph.org/projects/osg//browser/OpenSceneGraph/trunk/examples/osgvertexattributes/osgvertexattributes.cpp</a><br><br>Christian</div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-03-14 11:02 GMT+01:00 Sebastian Messerschmidt <span dir="ltr"><<a href="mailto:sebastian.messerschmidt@gmx.de" target="_blank">sebastian.messerschmidt@gmx.de</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000"><span class="">
    <div>Am 14.03.2016 um 09:16 schrieb Hyun
      Kwon:<br>
    </div>
    </span><blockquote type="cite">
      
      
      <div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">
        <div style="direction:ltr">
          <blockquote style="color:rgb(0,0,0);font-family:Tahoma;font-size:10pt;margin:0px 0px 0px 40px;border:none;padding:0px">
          </blockquote>
          <font size="2">Hi Sebastian,</font></div>
        <div style="direction:ltr"><font size="2"><br>
          </font></div>
        <div style="direction:ltr"><span class=""><font size="2">Thanks for the
            reply.<br>
          </font>
          <div style="color:rgb(0,0,0);font-family:Tahoma;font-size:10pt"><br>
            <blockquote style="margin:0 0 0 40px;border:none;padding:0px">
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <hr>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div style="direction:ltr"><font face="Tahoma" color="#000000" size="2"><b>From:</b>
                    osg-users
                    [<a href="mailto:osg-users-bounces@lists.openscenegraph.org" target="_blank">osg-users-bounces@lists.openscenegraph.org</a>] on
                    behalf of Sebastian Messerschmidt
                    [<a href="mailto:sebastian.messerschmidt@gmx.de" target="_blank">sebastian.messerschmidt@gmx.de</a>]</font></div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div style="direction:ltr"><font face="Tahoma" color="#000000" size="2"><b>Sent:</b>
                    Sunday, March 13, 2016 4:03 AM</font></div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div style="direction:ltr"><font face="Tahoma" color="#000000" size="2"><b>To:</b>
                    OpenSceneGraph Users</font></div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div style="direction:ltr"><font face="Tahoma" color="#000000" size="2"><b>Subject:</b>
                    Re: [osg-users] Running OSG models on OpenGLES2.0</font></div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div style="direction:ltr"><br>
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>
                  <div>Hi Hyun,</div>
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>
                  <div><br>
                  </div>
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>
                  <div><br>
                  </div>
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>
                  <blockquote type="cite">
                    <div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">Hi Chris,
                    </div>
                  </blockquote>
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>
                  <blockquote type="cite">
                    <div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">
                      <div><br>
                      </div>
                    </div>
                  </blockquote>
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>
                  <blockquote type="cite">
                    <div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">
                      <div>I tried most of examples. Now I'm focusing on
                        glsl_simple.osgt as it looks simple, but only
                        the second row of shapes shows. If I modify the
                        vertex shader a little, I get to see both
                        first/second row.</div>
                    </div>
                  </blockquote>
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>Can you tell us which platform you are using?  You
                  usually don't have to add precision qualifiers to make
                  shaders work.
                </div>
                <div><br>
                </div>
              </div>
            </blockquote>
            I have Xilinx ZynqMP SoC with MALI 400MP, and I'm running
            Ubuntu on it. I also have Yocto built rootfs. I've
            integrated the MALI OpenGLES2 library/driver there, and I'm
            building OSG manually. It fails to compile if I don't add
            the precision for float & int in shaders. The OSG build
            configuration is more or less as below (it's for 3.4.0),
            with some addition to point to EGL/OPENGLES2 libraries and
            headers:</div>
          <div style="color:rgb(0,0,0);font-family:Tahoma;font-size:10pt"><br>
          </div>
          </span><div>
            <blockquote style="color:rgb(0,0,0);font-family:Tahoma;font-size:10pt;margin:0px 0px 0px 40px;border:none;padding:0px">...<span class=""><br>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>
                  <blockquote type="cite">
                    <div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">
                      <div>I've received some OSG model (file.osg) from
                        someone, and I was able to run it on the desktop
                        (OpenGL). I was told the OSG model runs on
                        OpenGLES2.0. For me to run it on OpenGLES2, I
                        added the precision qualifiers to build, but the
                        result still doesn't look correct. I'm not sure
                        if more / what modification is needed. For
                        example, I modified the OSG shader generator,
                        but it didn't help. Does OSG layers completely
                        abstract underlying APIs (OpenGL, OpenGLES,,,),
                        meaning the OSG models are API independent? or
                        does each OSG model have some API specific code?
                        For example, I don't see any precision
                        qualifiers in OSG examples, and does that mean
                        those models are not for OpenGLES2.0?</div>
                    </div>
                  </blockquote>
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>OSG doesn't completely abstract the APIs, but it
                  can be built specifically to work with OpenGL ES, by
                  using the compiler flags you used. You will however
                  have to put some work into it, since you will have to
                  write shaders. Since you are not telling us which
                  "shader generator" you are using, it is hard to guess
                  what you are trying to achieve.
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>There is not something like "models for
                  OpenGLES2.0". You will have to write appropriate
                  shaders and might have to run some visitors to change
                  fixed function pipeline functions in to
                  uniforms/attributes of the model.</div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>For instance osg::Material is not working outside
                  the compatibility -profiles, so might have to run a
                  visitor, that parses osg::Material instances and
                  replaces them with uniforms or per-vertex attributes
                  which you will have to evaluate in the shader.
                </div>
              </div>
            </span></blockquote><span class="">
            <br>
            <blockquote style="color:rgb(0,0,0);font-family:Tahoma;font-size:10pt;margin:0px 0px 0px 40px;border:none;padding:0px">
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>
                  <blockquote type="cite">
                    <div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">
                      <div><br>
                      </div>
                    </div>
                  </blockquote>
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>
                  <blockquote type="cite">
                    <div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">
                      <div>I'm trying to figure out where the issue
                        comes from: OSG model, OSG layers, OpenGLES
                        library.</div>
                    </div>
                  </blockquote>
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div><br>
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>Chris asked you for an example model that is not
                  working. You mentioned the glsl-simple model, which
                  from a glance doesn't have ES-compatible code. The
                  easiest thing to do is to start with a
                  model(preferably not containing shaders) and a simple
                  ES-Shader.</div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>Unfortunately the examples here are relatively
                  rare. Might be a great opportunity to create some
                  minimalistic core/ES-based shader example and to
                  extend the OpenGL-ES pseudo loader.
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div><br>
                </div>
              </div>
            </blockquote>
            <font face="Times New Roman" size="3">If there are already
              OSG models confirmed to work with OpenGLES2, I'd use those
              to validate my platform. But, none of examples in
              OpenSceneGraph-Data shows correct results on my platform </font><span style="font-family:'Times New Roman';font-size:medium">(nothing

              displayed except the glsl_simple.osgt)</span><span style="font-family:'Times New Roman';font-size:medium"> </span><span style="font-family:'Times New Roman';font-size:medium">comparing
              to results from desktop with OpenGL. Once my platform is
              confirmed to work, I will be able to focus
              on debugging the model. With lack of OSG / shader
              experience, I can't easily tell where the issue comes
              from, and I'm looking for references for validation.</span></span></div>
        </div>
      </div>
    </blockquote>
    Can't you try some other GLES applications(plain OpenGL-ES without
    OSG)  and check their shader code? I believe there is a problem with
    your system/driver, as there is no need to explicitly issuing the
    precision in normal cases. <br>
    All models should work in theory if you have some minimal shader for
    it. <br>
    Out of my head a minimal shader should look like the following. It
    will display a red-colored version of your geometry. <br>
    <br>
    Vertex:<br>
    #version 100<br>
    attribute vec4 osg_Vertex;<br>
    uniform mat4 osg_ModelViewProjectionMatrix;<br>
    <br>
    void main()<br>
    {<br>
        gl_Position = osg_ModelViewProjectionMatrix * osg_Vertex;<br>
    }<br>
    <br>
    Fragment:<br>
    <br>
    #version 100<br>
    <br>
    void main()<br>
    {<br>
        gl_FragColor = vec4(1,0,0,1);<br>
    }<br>
    <br>
    Setting this shader to you scene should display everything correct.
    If my code is valid, it should compile without any precision
    qualifiers. <br>
    <br>
    Cheers<span class="HOEnZb"><font color="#888888"><br>
    Sebastian <br></font></span><span class="">
    <br>
    <blockquote type="cite">
      <div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">
        <div style="direction:ltr">
          <div><font face="Times New Roman" size="3"><br>
            </font></div>
          <div><font face="Times New Roman" size="3">Thanks,</font></div>
          <div><font face="Times New Roman" size="3">-hyun<br>
            </font>
            <blockquote style="color:rgb(0,0,0);font-family:Tahoma;font-size:10pt;margin:0px 0px 0px 40px;border:none;padding:0px">
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div><br>
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>
                  <blockquote type="cite">
                    <div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">
                      <div>Thanks,</div>
                    </div>
                  </blockquote>
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>
                  <blockquote type="cite">
                    <div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">
                      <div>-hyun  </div>
                    </div>
                  </blockquote>
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div><br>
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div><br>
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>Cheers</div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>Sebastian </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>
                  <blockquote type="cite">
                    <div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">
                      <div><br>
                      </div>
                    </div>
                  </blockquote>
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>
                  <blockquote type="cite">
                    <div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">
                      <div>
                        <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                          <hr>
                        </div>
                      </div>
                    </div>
                  </blockquote>
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>
                  <blockquote type="cite">
                    <div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">
                      <div>
                        <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                          <div style="direction:ltr"><font face="Tahoma" color="#000000" size="2"><b>From:</b>
                              osg-users [<a href="mailto:osg-users-bounces@lists.openscenegraph.org" target="_blank">osg-users-bounces@lists.openscenegraph.org</a>]
                              on behalf of Chris Hanson [<a href="mailto:xenon@alphapixel.com" target="_blank"></a><a href="mailto:xenon@alphapixel.com" target="_blank">xenon@alphapixel.com</a>]</font></div>
                        </div>
                      </div>
                    </div>
                  </blockquote>
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>
                  <blockquote type="cite">
                    <div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">
                      <div>
                        <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                          <div style="direction:ltr"><font face="Tahoma" color="#000000" size="2"><b>Sent:</b>
                              Friday, March 11, 2016 5:27 PM</font></div>
                        </div>
                      </div>
                    </div>
                  </blockquote>
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>
                  <blockquote type="cite">
                    <div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">
                      <div>
                        <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                          <div style="direction:ltr"><font face="Tahoma" color="#000000" size="2"><b>To:</b>
                              OpenSceneGraph Users</font></div>
                        </div>
                      </div>
                    </div>
                  </blockquote>
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>
                  <blockquote type="cite">
                    <div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">
                      <div>
                        <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                          <div style="direction:ltr"><font face="Tahoma" color="#000000" size="2"><b>Subject:</b>
                              Re: [osg-users] Running OSG models on
                              OpenGLES2.0</font></div>
                        </div>
                      </div>
                    </div>
                  </blockquote>
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>
                  <blockquote type="cite">
                    <div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">
                      <div>
                        <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                          <div style="direction:ltr"><br>
                          </div>
                        </div>
                      </div>
                    </div>
                  </blockquote>
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>
                  <blockquote type="cite">
                    <div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">
                      <div>
                        <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                          <div>
                            <div dir="ltr">OGL ES requires a shader.​ </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </blockquote>
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>
                  <blockquote type="cite">
                    <div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">
                      <div>
                        <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                          <div>
                            <div dir="ltr">
                              <div><br>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </blockquote>
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>
                  <blockquote type="cite">
                    <div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">
                      <div>
                        <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                          <div>
                            <div dir="ltr">
                              <div>Many of the OSG-Data models don't
                                have shaders built into them, and will
                                not transform and rasterize as a result.</div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </blockquote>
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>
                  <blockquote type="cite">
                    <div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">
                      <div>
                        <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                          <div>
                            <div dir="ltr">
                              <div><br>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </blockquote>
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>
                  <blockquote type="cite">
                    <div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">
                      <div>
                        <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                          <div>
                            <div dir="ltr">
                              <div>Which OSG model did you try that had
                                most surfaces transparent?</div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </blockquote>
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>
                  <blockquote type="cite"><br>
                  </blockquote>
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>
                  <blockquote type="cite"><br>
                  </blockquote>
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>
                  <blockquote type="cite">This email and any attachments
                    are intended for the sole use of the named
                    recipient(s) and contain(s) confidential information
                    that may be proprietary, privileged or copyrighted
                    under applicable law. If you are not the intended
                    recipient, do not read, copy, or forward this email
                    message or any attachments. Delete this email
                    message and any attachments immediately.
                  </blockquote>
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>
                  <blockquote type="cite"><br>
                  </blockquote>
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>
                  <blockquote type="cite"><br>
                  </blockquote>
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>
                  <blockquote type="cite">
                    <fieldset></fieldset>
                  </blockquote>
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>
                  <blockquote type="cite"><br>
                  </blockquote>
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>
                  <blockquote type="cite">
                    <pre>_______________________________________________</pre>
                  </blockquote>
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>
                  <blockquote type="cite">
                    <pre>osg-users mailing list</pre>
                  </blockquote>
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>
                  <blockquote type="cite">
                    <pre><a href="mailto:osg-users@lists.openscenegraph.org" target="_blank">osg-users@lists.openscenegraph.org</a></pre>
                  </blockquote>
                </div>
              </div>
              <div style="font-family:Times New Roman;color:#000000;font-size:16px">
                <div>
                  <blockquote type="cite">
                    <pre><a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a></pre>
                  </blockquote>
                </div>
              </div>
            </blockquote>
            <div>
              <div><br>
              </div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <br>
      This email and any attachments are intended for the sole use of
      the named recipient(s) and contain(s) confidential information
      that may be proprietary, privileged or copyrighted under
      applicable law. If you are not the intended recipient, do not
      read, copy, or forward this email message or any attachments.
      Delete this email message and any attachments immediately.
      <br>
      <br>
      <br>
      <fieldset></fieldset>
      <br>
      <pre>_______________________________________________
osg-users mailing list
<a href="mailto:osg-users@lists.openscenegraph.org" target="_blank">osg-users@lists.openscenegraph.org</a>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a>
</pre>
    </blockquote>
    <br>
  </span></div>

<br>_______________________________________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org">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>
<br></blockquote></div><br></div>