HI Daniel,

Please don't use the createGeodeForImage() function for this task, is
just a convinence method for creating a simple model from an image
source, it doesn't provide any of the controls you need which is to
place the geometry where you want it - and where you want it is
governed by your projection matrix.  The follow functions from
include/osg/Geometry are more approrpiate:

/** Convenience function to be used for creating quad geometry with
texture coords.
  * Tex coords go from left bottom (l,b) to right top (r,t).
*/
extern OSG_EXPORT Geometry* createTexturedQuadGeometry(const Vec3&
corner,const Vec3& widthVec,const Vec3& heightVec, float l, float b,
float r, float t);

/** Convenience function to be used for creating quad geometry with
texture coords.
  * Tex coords go from bottom left (0,0) to top right (s,t).
*/
inline Geometry* createTexturedQuadGeometry(const Vec3& corner,const
Vec3& widthVec,const Vec3& heightVec, float s=1.0f, float t=1.0f)
{
    return createTexturedQuadGeometry(corner,widthVec,heightVec, 0.0f,
0.0f, s, t);
}

As well as the osghud example, have a look at osggeometry and
osgdistotion for insperation.

Robert.

On Dec 7, 2007 10:33 AM, Daniel Moos <[EMAIL PROTECTED]> wrote:
> Hi Robert
>
> Thanks for your answer...
> But I haven't got a clue, what you exactly mean. the geometry and the settings
> for this geometry are create by the function osg::createGeodeForImage()
>
> I have read the osghud code. But the only difference is that
> osg::createGeodeForImage() doesn't create normals. And the Vec3Array is a
> little bit different. In osghud are two more State-Settings:
>
>         osg::StateSet* stateset = geom->getOrCreateStateSet();
>         stateset->setMode(GL_BLEND,osg::StateAttribute::ON);
>         stateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
>
> Can you give some more information about it?
> Thank you for your answer.
> Daniel
>
>
> Am Freitag, 7. Dezember 2007 10.38:03 schrieb Robert Osfield:
>
> > HI Daniel,
> >
> > You'll need to place the geometry you want in orthographic frustum.
> > See the osghud for the settings used.
> >
> > Robert.
> >
> > On Dec 7, 2007 8:02 AM, Daniel Moos <[EMAIL PROTECTED]> wrote:
> > > Hello everybody
> > >
> > > I have a problem with showing an image in a HUD-Display. Here is my code
> > > to load and show the image. If i comment out the first two lines the
> > > image is visible in the 3d world. But with the two lines the image isn't
> > > visible in the scenegraph... Has anybody any idea?
> > >
> > > I want to show a simple image in the center of the screen.
> > >
> > > Thanks a lot...
> > > Daniel
> > >
> > >
> > > _camera->setReferenceFrame ( osg::Transform::ABSOLUTE_RF );
> > > _camera->setProjectionMatrixAsOrtho2D ( 0, 1280, 0, 1024 );
> > > _camera->setViewMatrix ( osg::Matrix::identity() );
> > > _camera->setRenderOrder ( osg::Camera::POST_RENDER );
> > > _camera->setClearMask ( GL_DEPTH_BUFFER_BIT );
> > >
> > > osg::ref_ptr<osg::Image> image = osg::readImageFile ( "test.png" );
> > > if ( image.valid() ) {
> > >         _geode = osg::createGeodeForImage ( image.get() );
> > >         _camera->addChild ( _geode.get() );
> > > }
> > > _______________________________________________
> > > 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
>
>
> _______________________________________________
> 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