Hi David,

Thanks for the file changes, I'll have a look once I'm back at my work machine.

W.r.t results from different models, the osgUtil::ShaderGen class that
is used to convert fixed function scene graph state into
shaders+uniforms is not complete, it only maps a modest range of fixed
OpenGL state so not all scene graphs can be mapped correctly.

As things stand the way to use OSG+GLES2 is to build your scene graphs
with shaders appropriate for you target platform.  This does put more
onus on you developing the application as there is no fixed function
pipeline there as a fallback.

Robert.

On Fri, Jan 22, 2010 at 8:53 PM, picoflamingo
<[email protected]> wrote:
> Hi Robert,
>
> Please find attached the files I modified (osg/State.cpp and
> osgUtil/ShaderGen.cpp). I just change the "ifs" related to my test model
>  that are very simple, just geometry and color/material.
>
> With the modification in the attached files I can see the glider.osg without
> problems, but trying to load some 3DS models with material produces black
> pixels (almost that is what I think)... I just see the silhouette. I have to
> force a value for the color in the vertex shader in order to get a
> grey-shaded model
>
> I also include a DEBUG_INFO log (for instance the list of supported
> extensions could be useful). Hope that could help.
>
> Many thanks for looking into this.
>
> cheers!
> david
>
> Robert Osfield wrote:
>>
>> Hi David,
>>
>> I believe the shaders are actually compiliant with GLES 2.0, but the
>> drivers you have add they own restrictions.
>>
>> Could you send me the modified files so I can review them with a view
>> to merging them in some form.
>>
>> Cheers,
>> Robert.
>>
>> On Thu, Jan 21, 2010 at 8:37 PM, picoflamingo
>> <[email protected]> wrote:
>>>
>>> Hello,
>>>
>>> Not sure if this has been reported so far (I couldn't find anything in
>>> the
>>> mailing list archive).
>>>
>>> I have been trying to run OSG 2.9.6 in a BeagleBoard (OpenGL ES 2.0) with
>>> partial success. Just after compiling, when running osgviewer, I got a
>>> window with the classical OSG blue background but nothing was rendered.
>>> Looking at the log, I found that the vertex and fragment shaders
>>> compilation
>>> failed.
>>>
>>> The main problem is that the OpenGL ES 2.0 library for the BeagleBoard
>>> expects a precision qualifier for every single declaration. This doesn't
>>> happen in the Imagination emulator, so it has to be tried in the real HW
>>> (AFAIK).
>>>
>>> I modified the ShaderGen.cpp file to include the missing qualifiers (I
>>> just
>>> prepend highp to every single vec and mat declaration, including
>>> attributes,
>>> uniforms and varyings). I also modify State.cpp to add the qualifier to
>>> the
>>> different Uniforms, but I'm not sure if that had some effect.
>>>
>>> Finally, I just override the ShaderGen.cpp to produce a simple
>>> vertex/fragment shader-pair just to check that it can render something,
>>> and
>>> that worked for simple color objects (no material, no texture,...). I
>>> could
>>> render the axis.osg and glider.osg models.
>>>
>>> I do not know enough about OSG internals to produce a proper patch for
>>> this,
>>> so hope that this information could help to make OSG work in the
>>> BeagleBoard
>>> (and probably in other OMAP3 platforms -OpenPandora, N900,..-) in the
>>> next
>>> stable release. If I can help in any way (as tester for instance), please
>>> just let me know.
>>>
>>> I was using the OSG 2.9.6 tarball, not the svn version, so if this is
>>> already fixed, please ignore this message.
>>>
>>> Many thanks.
>>>
>>> david
>>> --
>>> picoFlamingo Project: http://community.papermint-designs.com/
>>> _______________________________________________
>>> osg-users mailing list
>>> [email protected]
>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>
>> _______________________________________________
>> osg-users mailing list
>> [email protected]
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>
>
> RegisterWindowingSystemInterfaceProxy()
> X11WindowingSystemInterface()
> GraphicsContext::setWindowingSystemInterface() 0x1ad68  0x40a46b44
> CullSettings::readEnvironmentalVariables()
> DatabasePager::addDatabaseThread() HANDLE_NON_HTTP
> DatabasePager::addDatabaseThread() HANDLE_ONLY_HTTP
> CullSettings::readEnvironmentalVariables()
> CullSettings::readEnvironmentalVariables()
> CullSettings::readEnvironmentalVariables()
> CullSettings::readEnvironmentalVariables()
> CullSettings::readEnvironmentalVariables()
> itr='/home/root/osg/lib'
> FindFileInPath() : trying /home/root/osg/lib/osgPlugins-2.9.6/osgdb_3ds.so
> ...
> FindFileInPath() : USING /home/root/osg/lib/osgPlugins-2.9.6/osgdb_3ds.so
> Opened DynamicLibrary osgPlugins-2.9.6/osgdb_3ds.so
> FindFileInPath(../3D1.3ds): returning ../3D1.3ds
> NODE TRAVERSAL of 3ds file LIB3DS
> MESH TRAVERSAL of 3ds file LIB3DS
>  mesh name Font
>  1 0 0 0
>  0 1 0 0
>  0 0 1 0
>  0 0 0 1
> Warning: in 3ds loader: file has no nodes, traversing by meshes instead
> Final OSG node structure looks like this:
>    Group
>        Geode
> View::setSceneData() Reusing exisitng scene0x1b2c8
> ShaderGenCache Vertex shader:
> varying highp vec4 glFrontColor;
> varying highp float diffuse;
> attribute highp vec4 osg_Normal;
>
> void main()
> {
>  gl_Position = ftransform();
>  highp vec3 lightPosition = vec3 (50.0, 100.0, -100.0);
>  glFrontColor = gl_Color;
>  diffuse = max(dot(normalize (gl_ModelViewProjectionMatrix * osg_Normal),
> normalize(vec4(lightPosition, 1.0))), 0.0);
> }
>
> ShaderGenCache Fragment shader:
> varying highp vec4 glFrontColor;
> varying highp float diffuse;
>
> void main()
> {
>  highp vec4 base = vec4(1.0);
>  highp vec4 color = base;
>  highp vec4 amb = vec4 (1.0, 1.0, 1.0, 1.0);
>  color = amb * diffuse * glFrontColor;
>  gl_FragColor = color;
> }
>
> Viewer::realize() - No valid contexts found, setting up view across all
> screens.
> GraphicsContext::getWindowingSystemInterface() 0x1ad68  0x40a46b44
> (EE) omapfb(0): FBIOBLANK: Invalid argument
> (EE) omapfb(0): FBIOBLANK: Invalid argument
> GraphicsContext::registerGraphicsContext 0x32918
> (EE) omapfb(0): FBIOBLANK: Invalid argument
> (EE) omapfb(0): FBIOBLANK: Invalid argument
> GraphicsWindowX11::init() - eglInitialize() succeded eglMajorVersion=1
> iMinorVersion=4
> GraphicsContext::getWindowingSystemInterface() 0x1ad68  0x40a46b44
> GraphicsWindowX11::init() - window created =1
> GraphicsContext::createNewContextID() creating contextID=0
> Updating the MaxNumberOfGraphicsContexts to 1
>  GraphicsWindow has been created successfully.
> osg::State::_maxTexturePoolSize=0
> osg::State::_maxBufferObjectPoolSize=0
> Viewer::startThreading() - starting threading
> Viewer::startThreading() - contexts.size()=1
> View::init()
> FocusOut/UnmapNotify event received
> FocusIn event received
> KeymapNotify event received
> OpenGL extensions supported by installed OpenGL drivers are:
>    GL_EXT_multi_draw_arrays
>    GL_IMG_shader_binary
>    GL_IMG_texture_compression_pvrtc
>    GL_IMG_texture_npot
>    GL_IMG_texture_stream2
>    GL_OES_EGL_image
>    GL_OES_compressed_ETC1_RGB8_texture
>    GL_OES_depth24
>    GL_OES_element_index_uint
>    GL_OES_fragment_precision_high
>    GL_OES_mapbuffer
>    GL_OES_rgb8_rgba8
>    GL_OES_texture_float
>    GL_OES_texture_half_float
>    GL_OES_vertex_half_float
> OpenGL extension 'GL_ARB_vertex_shader' is not supported.
> OpenGL extension 'GL_ARB_multitexture' is not supported.
> OpenGL extension 'GL_EXT_multitexture' is not supported.
> OpenGL extension 'GL_EXT_geometry_shader4' is not supported.
> OpenGL extension 'GL_EXT_gpu_shader4' is not supported.
> glVersion=0, isGlslSupported=YES, glslLanguageVersion=0
> State::convertShaderSourceToOsgBuiltIns()
> ++Before Converted source
> varying highp vec4 glFrontColor;
> varying highp float diffuse;
> attribute highp vec4 osg_Normal;
>
> void main()
> {
>  gl_Position = ftransform();
>  highp vec3 lightPosition = vec3 (50.0, 100.0, -100.0);
>  glFrontColor = gl_Color;
>  diffuse = max(dot(normalize (gl_ModelViewProjectionMatrix * osg_Normal),
> normalize(vec4(lightPosition, 1.0))), 0.0);
> }
>
> ++++++++
> -------- Converted source
> uniform highp mat4 osg_ModelViewProjectionMatrix;
> attribute highp vec4 osg_Color;
> attribute highp vec4 osg_Vertex;
> varying highp vec4 glFrontColor;
> varying highp float diffuse;
> attribute highp vec4 osg_Normal;
>
> void main()
> {
>  gl_Position = osg_ModelViewProjectionMatrix * osg_Vertex;
>  highp vec3 lightPosition = vec3 (50.0, 100.0, -100.0);
>  glFrontColor = osg_Color;
>  diffuse = max(dot(normalize (osg_ModelViewProjectionMatrix * osg_Normal),
> normalize(vec4(lightPosition, 1.0))), 0.0);
> }
>
> ----------------
>
> Compiling VERTEX source:
>    1: uniform highp mat4 osg_ModelViewProjectionMatrix;
>    2: attribute highp vec4 osg_Color;
>    3: attribute highp vec4 osg_Vertex;
>    4: varying highp vec4 glFrontColor;
>    5: varying highp float diffuse;
>    6: attribute highp vec4 osg_Normal;
>    7:
>    8: void main()
>    9: {
>   10:   gl_Position = osg_ModelViewProjectionMatrix * osg_Vertex;
>   11:   highp vec3 lightPosition = vec3 (50.0, 100.0, -100.0);
>   12:   glFrontColor = osg_Color;
>   13:   diffuse = max(dot(normalize (osg_ModelViewProjectionMatrix *
> osg_Normal), normalize(vec4(lightPosition, 1.0))), 0.0);
>   14: }
>
> VERTEX Shader "" infolog:
> Success.
>
>
> Compiling FRAGMENT source:
>    1: varying highp vec4 glFrontColor;
>    2: varying highp float diffuse;
>    3:
>    4: void main()
>    5: {
>    6:   highp vec4 base = vec4(1.0);
>    7:   highp vec4 color = base;
>    8:   highp vec4 amb = vec4 (1.0, 1.0, 1.0, 1.0);
>    9:   color = amb * diffuse * glFrontColor;
>   10:   gl_FragColor = color;
>   11: }
>
> FRAGMENT Shader "" infolog:
> Success.
> Linking osg::Program "" id=210003 contextID=0
> State's vertex attrib binding 2, osg_Color
> State's vertex attrib binding 7, osg_FogCoord
> State's vertex attrib binding 3, osg_MultiTexCoord0
> State's vertex attrib binding 4, osg_MultiTexCoord1
> State's vertex attrib binding 5, osg_MultiTexCoord2
> State's vertex attrib binding 6, osg_MultiTexCoord3
> State's vertex attrib binding 7, osg_MultiTexCoord4
> State's vertex attrib binding 1, osg_Normal
> State's vertex attrib binding 6, osg_SecondaryColor
> State's vertex attrib binding 0, osg_Vertex
>        Uniform "osg_ModelViewProjectionMatrix" loc=1 size=1 type=highp mat4
>        Attrib "osg_Vertex" loc=0 size=1
>        Attrib "osg_Color" loc=2 size=1
>        Attrib "osg_Normal" loc=1 size=1
>
> OpenGL extension 'GL_ARB_vertex_program' is not supported.
> OpenGL extension 'GL_EXT_secondary_color' is not supported.
> OpenGL extension 'GL_EXT_fog_coord' is not supported.
> OpenGL extension 'GL_ARB_multitexture' is not supported.
> OpenGL extension 'GL_NV_occlusion_query' is not supported.
> OpenGL extension 'GL_ARB_occlusion_query' is not supported.
> OpenGL extension 'GL_EXT_timer_query' is not supported.
> OpenGL extension '' is not supported.
> OpenGL extension 'GL_EXT_packed_depth_stencil' is not supported.
> Setting up osg::Camera::FRAME_BUFFER
> (EE) omapfb(0): FBIOBLANK: Invalid argument
> (EE) omapfb(0): FBIOBLANK: Invalid argument
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to