Hi Yanling,

There won't be a problem with CameraNode's and display lists, the two
are totally orthogonal.

Do you have a custom viewer?  If so are flushing delete OpenGL objects
on each frame?  If not then you need to call :

  sceneView->flushDeletedGLObjects(double& availableTime);

Where availableTime is a double set to how much time you want to give
over to flushing deleted OpenGL obejcts.

Robert.

On 7/20/06, Yanling Liu <[EMAIL PROTECTED]> wrote:
Hi, my HUD was find with OSG 1.0 except have to set DO_NOT_COMPUTE_FAR_NEAR.
After switch to OSG 1.1, my HUD becomes a black screen and there is huge
memory consumption (eat 40MB approximately every one second and keep
eating).

Here is my code:

In SceneView I attached a CameraNode:

//create hud
    m_hudNode = new CCAuxHUDNode; //extend CameraNode and put HUD stuff
inside the node
    m_hudNode->CreateHUD(m_viewWidth, m_viewHeight);

    m_hudNode->setProjectionMatrix(osg::Matrix::ortho2D(0,
m_viewWidth, 0, m_viewHeight));

m_hudNode->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
    m_hudNode->setViewMatrix(osg::Matrix::identity());

    m_hudNode->setClearMask(GL_DEPTH_BUFFER_BIT);

m_hudNode->setRenderOrder(osg::CameraNode::POST_RENDER);

    m_root->addChild(m_hudNode.get());

In CCAuxHUDNode::CreateHUD(), I created a console and attached a transparent
quad to it:

osg::BoundingBox bb;
    bb.set(40.0f, 42.0f, 0.0f, width - 40.0f, height - 42, 0.0f);

    osg::Vec3Array* vertices = new osg::Vec3Array;
    float depth = -0.1f;
    vertices->push_back(osg::Vec3( bb.xMin(),bb.yMax(),depth));
    vertices->push_back(osg::Vec3(bb.xMin(),bb.yMin(),depth));
    vertices->push_back(osg::Vec3(bb.xMax(),bb.yMin(),depth));
    vertices->push_back(osg::Vec3(bb.xMax(),bb.yMax (),depth));
    m_consoleGeom->setVertexArray(vertices);

    osg::Vec3Array* normals = new osg::Vec3Array;
    normals->push_back(osg::Vec3(0.0f, 0.0f, 1.0f));
    m_consoleGeom->setNormalArray(normals);

m_consoleGeom->setNormalBinding(osg::Geometry::BIND_OVERALL);

    osg::Vec4Array* colors = new osg::Vec4Array;
    colors->push_back(osg::Vec4(0.1f, 0.1f, 0.2f, 0.5f));
    m_consoleGeom->setColorArray(colors);

m_consoleGeom->setColorBinding(osg::Geometry::BIND_OVERALL);

    m_consoleGeom->addPrimitiveSet(new
osg::DrawArrays(GL_QUADS,0,4));
    m_consoleGeom->setUseDisplayList(false);

    m_consoleNode->addDrawable(m_consoleText.get());
    m_consoleNode->addDrawable(m_consoleGeom.get());

    addChild(m_consoleNode.get());

As you can see, my code is nothing strange and every similiar with osgHud
example about the transparent quad.  Also you can see there is one line in
my code:
m_consoleGeom->setUseDisplayList(false);

When the line is there, my HUD works fine, no problem at all. But if I
comment this code, which means to use displaylist, then there is huge memory
consumption every second and keep going. I wonder if there is some bugs in
CameraNode about generating displaylist.

I also attached screen shot for my program and task manager. You could see
the memory consumption goes up very quickly.

Yanling

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/



_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to