Hello Sebastian,
Thank you for your reply.
You mean that the model did not show because I did not define the coordinates
of the texture. My app is based on iOS platform. And I compiled osg using
GLES1( I also have tried osg with GLES2, but found it hard to write shaders.)Is
it possible to solve this problem by combining texture1D(texgen) and
texture2D(2dtexture)?
Thank you.
Best regards,
NIE
SMesserschmidt wrote:
> Hi Nie,
>
> I guess there are no texture coordinates on your model.
> As i've written before, you can generate them if they are in object
> space anyways.
> If TexGen is not available on your platform, you can generate them in
> the vertex shader on the fly
>
> Cheers
> Sebastian
>
> > Hello Robert
> > Sorry for bothering you again.
> > I have tried using texture2D to create the gradation color and succeeded in
> > geometry like some boxes. But I failed in apply texture to STL models.
> > I succeeded in this one.
> >
> > Code:
> > osg::Image *pImage = osgDB::readImageFile("icondata.png");
> > osg::Texture2D* pTex = new osg::Texture2D();
> > pTex->setTextureSize(400, 400);
> > pTex->setImage(pImage);
> > pTex->setFilter( pTex->MIN_FILTER,pTex->LINEAR);
> > pTex->setFilter( pTex->MAG_FILTER,pTex->LINEAR);
> > osg::Geode* geode = new osg::Geode();
> > osg::ShapeDrawable* drawable = new osg::ShapeDrawable(new
> > osg::Box(osg::Vec3(1,1,1), 200));
> > geode->addDrawable(drawable);
> > geode->getOrCreateStateSet()->setTextureAttributeAndModes(0, pTex);
> > _root->addChild(geode);
> >
> >
> > I tried to apply texture to STL using this code. Nothing is shown on the
> > screen.
> >
> > Code:
> > osg::Image *pImage = osgDB::readImageFile("icondata.png");
> > osg::Texture2D* pTex = new osg::Texture2D();
> > pTex->setTextureSize(400, 400);
> > pTex->setImage(pImage);
> > pTex->setFilter( pTex->MIN_FILTER,pTex->LINEAR);
> > pTex->setFilter( pTex->MAG_FILTER,pTex->LINEAR);
> > osg::ref_ptr<osg::Node> model = //load a STL file
> > model->getOrCreateStateSet()->setTextureAttributeAndModes(0, pTex);
> >
> >
> > Could you give me some hints to solve this problem.
> > 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=61986#61986
> >
> >
> >
> >
> >
> > _______________________________________________
> > osg-users mailing list
> >
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
>
> _______________________________________________
> osg-users mailing list
>
> 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=61988#61988
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org