Hello Robert,
  Thank you.
  I have some problem when I try to run iPhone example of the OSG source.    
After referring to this 
post(http://forum.openscenegraph.org/viewtopic.php?t=14385 ),
I figured out both the "VERTEX xxx failed" problem and "texture not support" 
problem by adding 
Code:
    static const char gVertexShader1[] =
    "varying vec2 v_texCoord;                                         \n"
    "void main() {                                                          \n"
    "    gl_Position  = gl_ModelViewProjectionMatrix * gl_Vertex;           \n"
    "         v_texCoord   = gl_MultiTexCoord0.xy;                              
                          \n"
    "}                                                                  \n";
    
    static const char gFragmentShader1[] =
    "varying  mediump vec2 v_texCoord;                                          
                        \n"
    "uniform sampler2D sam;                                                     
                                                   \n"
    "void main() {                                                              
                                                          \n"
    "gl_FragColor = texture2D(sam, v_texCoord);                                 
                                       \n"
    "}                                                                      \n";
    osg::Shader* vShader = new osg::Shader( osg::Shader::VERTEX, gVertexShader1 
);
    osg::Shader* fShader = new osg::Shader( osg::Shader::FRAGMENT, 
gFragmentShader1 );
    
    osg::Program* program = new osg::Program;
    program->addShader( vShader );
    program->addShader( fShader );
    _root->getorcreatestateset->setAttribute( program );


 
Although the problem has been solved, I still do not know why it works after 
adding this code.
Thank you very much. 
Best regards,
NIE   


robertosfield wrote:
> Hi Nie,
> 
> 
> iOS only support OpenGL ES, so you only can compile against GLES1 or 2, if 
> you want to do graphics on iOS then you have no choice beyond these.  These 
> two versions of GLES are very different so you'll need to tackle both very 
> differently so you'll need to decide which route you want to go.
> 
> Robert.
> 
> 
> 
> 
> On 28 November 2014 at 06:04, Nie Junxiao < ()> wrote:
> 
> > Hello Robert,
> >     Thank you for replying.
> >     I have checked osgtexture1D example and apply it to my source 
> > code(actually it is an iOS app). Then I found that I have built osglib 
> > using GLES_1_available and GLES_2_available, which makes texture1D not 
> > available in osg( err<<"texgen not supported" ). Is there an alternative 
> > way to use texture1D, or I have to rebuild osglib with GLES_1_available and 
> > GLES_2_available off? I think that I am not using GLES in my project.
> > 
> > Thank you.
> > NIE
> > 
> > ------------------
> > Read this topic online here:
> > http://forum.openscenegraph.org/viewtopic.php?p=61899#61899 
> > (http://forum.openscenegraph.org/viewtopic.php?p=61899#61899)
> > 
> > 
> > 
> > 
> > 
> > _______________________________________________
> > osg-users mailing list
> >  ()
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org 
> > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org)
> > 
> > 
> > 
> 
> 
>  ------------------
> Post generated by Mail2Forum


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





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to