Hi,

I have a problem for displaying a textured quad. The view does not display 
anything, and result in a blank screen.
The purpose of my application is to display video frames in the textured quad.
I verified several things, as the texture's image updating, the camera view and 
projection matrices, the possibility of viewing a simple box instead of the 
textured quad, at its position. All of those operations are working, so I 
concluded that there is a problem with my textured quad.

My code looks as follow :


Code:
ClientViewer::initialize()
{
  // _renderingFrame is an osg::Image attached to the texture
  // it is initialized in an other method

  // graphics context initialization

  // camera initialization

  // _viewer initialization

  _texture = new osg::TextureRectangle();
  _texture->setTextureSize(_renderingFrame->s(), _renderingFrame->t());
  _texture->setImage(_renderingFrame);
  osg::ref_ptr<osg::Geometry> quad = 
osg::createTexturedQuadGeometry(osg::Vec3(), osg::Vec3(_renderingFrame->s(), 0, 
0), osg::Vec3(0, 0, _renderingFrame->t()), 0, 0, 1, 1);
  quad->getOrCreateStateSet()->setAttributeAndModes(0, _texture.get(), 
osg::StateAttribute::ON);
  _videoSupport = new osg::Geode;
  _videoSupport->addDrawable(quad.get());
  
  osg::ref_ptr<PositionAttitudeTransform> pat = new 
osg::PositionAttitudeTransform();
  pat->addChild(_videoSupport);
  pat->setPosition(osg::Vec3(0, 0, Z));
  _viewer->setSceneData(pat);
  _viewer->realize();
}



Then the render method looks as follow :


Code:
ClientViewer::render()
{
  // Initialize the image _videoFrame with the video content
  // protect copy with mutexes
  ...
  memcpy(_renderingFrame->data(), _videoFrame->data(), 
_videoFrame->getImageSizeInBytes());
  _renderingFrame->dirty();
  // dump _renderingFrame to verify its content
  ...
  _viewer->frame();

  // Go back to the rendering loop of the thread
}



The images dumped from the _renderingFrame are good and follows the video 
content. Replacing the textured quad with a simple box, show the box in view.

I suppose that there is a compatibility problem between _renderingFrame and 
_texture. But I cannot find the problem.
My image is coded as a 24 bits RGB image in GL_UNSIGNED_BYTE.

What can I test to find the problem with the texture ?

Solved my problem, I made a mistake when specifying the height vector. My 
texture quad was seen on its profile and so was invisible :( :(
Thank you!

Cheers,
Mike
Code:




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





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to