John Steinbis wrote:
> For an AR project, I need to render a model with video image as
> background. My program is based around osgViewer using OpenSG v2.0. I
> have found "OSGImageBackground" in v1.8 but no equivalent method in
> v2.0.
>
> How can I display an image as background using OpenSG v2.0? For now, a
> simple method would be preferred… I'm still trying to learn osg.
> Thanks
I'm not a 2.0 user, but I think there's the PolygonBackground or
stuff like that, you can use that for displaying images. Note
that the ImageBackground is relatively slow as it transfers
the image data from memory to the graphics board on every redraw.
Regards,
Toni
P.S.: Here's some 1.8 code that creates a PolygonBackground
(don't know if it works, just copied&pasted from around my
code, but it should give you the idea....):
ImagePtr imageBackgroundImg = Image::create();
TextureChunkPtr imageBackgroundtTex = TextureChunk::create();
beginEditCP(imageBackgroundtTex);
{
imageBackgroundtTex->setImage(imageBackgroundImg);
imageBackgroundtTex->setMinFilter(GL_LINEAR);
imageBackgroundtTex->setMagFilter(GL_LINEAR);
imageBackgroundtTex->setWrapS(GL_CLAMP_TO_EDGE);
imageBackgroundtTex->setWrapT(GL_CLAMP_TO_EDGE);
//if (!hasNPot)
// imageBackgroundtTex->setScale(false);
}
endEditCP(imageBackgroundtTex);
SimpleMaterialPtr mat = SimpleMaterial::create();
beginEditCP(mat);
mat->addChunk(imageBackgroundtTex);
endEditCP(mat);
PolygonBackgroundPtr m_pPolyBack = PolygonBackground::create();
beginEditCP( m_pPolyBack );
m_pPolyBack->setMaterial(mat);
//tile?
m_pPolyBack->setTile(false);
m_pPolyBack->getMFPositions()->push_back(Pnt2f(0.0, 0.0));
m_pPolyBack->getMFPositions()->push_back(Pnt2f(1.0, 0.0));
m_pPolyBack->getMFPositions()->push_back(Pnt2f(1.0, 1.0));
m_pPolyBack->getMFPositions()->push_back(Pnt2f(0.0, 1.0));
m_pPolyBack->getMFTexCoords()->push_back(Pnt2f(0.0,0.0));
m_pPolyBack->getMFTexCoords()->push_back(Pnt2f(1.0,0.0));
m_pPolyBack->getMFTexCoords()->push_back(Pnt2f(1.0,1.0));
m_pPolyBack->getMFTexCoords()->push_back(Pnt2f(0.0,1.0));
endEditCP( m_pPolyBack );
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users