Hi Peter,

What be hidden inside the updateCamera() call???

Why use overpainting?  What effect are you after?

Robert.

On 6/11/07, Peter O <[EMAIL PROTECTED]> wrote:
Hi,

I'm trying to adapt the QT overpainting example ( drawing 2D primitives and
text over a 3D scene ) to use osg instead of raw openGL. However, the mesh
I'm drawing only appears for the first paintEvent and then disappears from
the view. If I comment out any qpainter draw commands the mesh is correctly
redrawn and can be rotated etc.

Has anyone managed to get overpainting to work with osg?

Here is my paintEvent method in case anyone can spot any obvious errors:

void Viewer::paintEvent( QPaintEvent * )
{
    qDebug() << "PaintEvent";

    QPainter painter;
    painter.begin(this);
    painter.setRenderHint(QPainter::Antialiasing);
    painter.setBrush( Qt::red );

    // Preserve the current GL state.
    glPushAttrib( GL_ALL_ATTRIB_BITS );
    glMatrixMode(GL_PROJECTION);
    glPushMatrix();
    glMatrixMode(GL_TEXTURE);
    glPushMatrix();
    glMatrixMode(GL_MODELVIEW);
    glPushMatrix();

    // Do our OSG stuff...
    /resizeGL( width(), height() );
    updateCamera();

    m_scene->update();
    m_scene->cull();
    m_scene->draw();

    // Restore the old GL state.
    glMatrixMode(GL_TEXTURE);
    glPopMatrix();
    glMatrixMode(GL_PROJECTION);
    glPopMatrix();
    glMatrixMode(GL_MODELVIEW);
    glPopMatrix();
    glPopAttrib();

    painter.drawLine( 0, 0, width(), height() );

    painter.end();

}

Thanks in advance for any tips or help.

Pete.



_______________________________________________
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