Hi all,

our problem is that different rendered osg:Textures are missing single row or 
column of the corresponding osg::Image. Each row or column can be missed. The 
missed rows or columns aren't only the outer but also the inner ones. 

It was noticed by an osg::Texture2D, whose image size is only 8 by 8 pixel. But 
it happens also by other Textures with a bigger size, where a missing 
row/column doesn't really interest. 

The lose of the row or column in the texture happens, if ...

 ... the view size (height,width) is changed.
 ... the content of the view is moved.
 ... the content of the view is zoomed with the mouse wheel.

If you go back or moved further the missing row/column appears again.

This is the code of the osg::Texture with the 8x8 Image:


    osg::Geode* osgGeode = new osg::Geode();

    osg::Geometry* osgGeometry = new osg::Geometry();
    osgGeode->addDrawable(osgGeometry);

    //create vertex array for graphics item
    osg::Vec3Array* vertices = new osg::Vec3Array;
    vertices->push_back(osg::Vec3(-(w/2) + 0.0f,           - (h/2) -(h_texture 
- h) + 0.0f, 0.0));                      // bottom left
    vertices->push_back(osg::Vec3(-(w/2) + pImageOSG->s(), - (h/2) -(h_texture 
- h) + 0.0f, 0.0));            // bottom right
    vertices->push_back(osg::Vec3(-(w/2) + pImageOSG->s(), - (h/2) -(h_texture 
- h) + pImageOSG->t(), 0.0));  // top right
    vertices->push_back(osg::Vec3(-(w/2) + 0.0f,           - (h/2) -(h_texture 
- h) + pImageOSG->t(), 0.0));            // top left
    osgGeometry->setVertexArray(vertices);

    osg::Vec4Array* color = new osg::Vec4Array;
    color->push_back( osg::Vec4( 1., 1., 1., 1. ) );
    osgGeometry->setColorArray( color );
    osgGeometry->setColorBinding( osg::Geometry::BIND_OVERALL );

    // create primitive set drawable
    osg::DrawElementsUInt* polygon = new osg::DrawElementsUInt 
(osg::PrimitiveSet::TRIANGLE_STRIP, 0);
    polygon->push_back(0);
    polygon->push_back(1);
    polygon->push_back(3);
    polygon->push_back(2);
    osgGeometry->addPrimitiveSet(polygon);

    // create texture coordinates for graphics item
    osg::Vec2Array* texcoords = new osg::Vec2Array (4);
    (*texcoords)[0].set(0.0f, 0.0f); // tex coord for vertex 0
    (*texcoords)[1].set(1.0f, 0.0f); // tex coord for vertex 1
    (*texcoords)[2].set(1.0f, 1.0f); // ""
    (*texcoords)[3].set(0.0f, 1.0f); // ""
    osgGeometry->setTexCoordArray(0, texcoords);

    // create texture for graphics item
    osg::Texture2D* texture = new osg::Texture2D;

    texture->setDataVariance (osg::Object::DYNAMIC); // protect from being 
optimized away as static state
    texture->setFilter(osg::Texture2D::MIN_FILTER, osg::Texture2D::NEAREST);
    texture->setFilter(osg::Texture2D::MAG_FILTER, osg::Texture2D::NEAREST);
    texture->setImage(pImageOSG.get());

You can see, that we use no filtering, because the image has only a 8x8 size 
and with a filter the 8x8 image is blured.

A image file of the problem is attached. The Texture in the lower left corner 
is missing the second row from below, the Texture with same image in the upper 
right corner is well (8x8).

Is there any hope for fixing this problem or is it as feared a precision 
problem of OpenGL, which can't be solved?

Thank you!

Cheers,
Philip

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




Attachments: 
http://forum.openscenegraph.org//files/8x8problem_935.png


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

Reply via email to