Example #1
0
void QGLView::paintGLItem(QGLItem *item)
{
    if (item->isVisible())
    {
        item->paint(this);
    }
    else
    {
        removeDrawables(m_drawableListMap.value(item));     // if the item is not visible we remove all drawables
    }
}
Example #2
0
	void Bar::createGeometry()
	{
		removeDrawables(0, getNumDrawables());
		
		// Create border
		_bordergeometry = new osg::Geometry;
		_bordergeometry->setName("border");
		_bordervecs = new osg::Vec3Array;
		_bordervecs->resize(4);
		_bordergeometry->setVertexArray(_bordervecs);
		_bordergeometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_LOOP,0,4));
		_bordercolors = new osg::Vec4Array;
		_bordercolors->push_back(_bordercolor);
		_bordergeometry->setColorArray(_bordercolors);
		_bordergeometry->setColorBinding(osg::Geometry::BIND_OVERALL);
		addDrawable(_bordergeometry);
		
		// Create bar
		_bargeometry = new osg::Geometry;
		_bargeometry->setName("bar");
		_barvecs = new osg::Vec3Array;
		_barvecs->resize(4);
		_bargeometry->setVertexArray(_barvecs);
		_bargeometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4));
		_barcolors = new osg::Vec4Array;
		_barcolors->push_back(_barcolor);
		_bargeometry->setColorArray(_barcolors);
		_bargeometry->setColorBinding(osg::Geometry::BIND_OVERALL);
		addDrawable(_bargeometry);
		
		// Create mark
		_markgeometry = new osg::Geometry;
		_markgeometry->setName("mark");
		_markvecs = new osg::Vec3Array;
		_markvecs->resize(4);
		_markgeometry->setVertexArray(_markvecs);
		_markgeometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4));
		_markcolors = new osg::Vec4Array;
		_markcolors->push_back(_markcolor);
		_markgeometry->setColorArray(_markcolors);
		_markgeometry->setColorBinding(osg::Geometry::BIND_OVERALL);
		addDrawable(_markgeometry);
		
		setSize(_length,_width);
	}
Example #3
0
void Frame::rebuild()
{
    float zPos = -0.1f;

    removeDrawables(0, getNumDrawables());
    addDrawable(build_quad(rect_, bgcolor_));
    addDrawable(build_quad(Rect(rect_.x0 + 4, rect_.y1 - 24, rect_.x1 - 4, rect_.y1 - 4), osg::Vec4(0, 0, 0, bgcolor_.w()), false, zPos));

    osg::ref_ptr<osgText::Text> caption_text = new osgText::Text;
    caption_text->setText(caption_);
    caption_text->setColor(osg::Vec4(1, 1, 1, 1));
    caption_text->setAlignment(osgText::Text::CENTER_CENTER);
    caption_text->setFont("fonts/arial.ttf");
    caption_text->setCharacterSize(16);
    caption_text->setFontResolution(16, 16);
    caption_text->setPosition(osg::Vec3((rect_.x0 + rect_.x1) / 2, rect_.y1 - 15, zPos*2.0f));
    addDrawable(caption_text.get());

    rebuild_client_area(Rect(rect_.x0 + 4, rect_.y0 + 4, rect_.x1 - 4, rect_.y1 - 28));
}
Example #4
0
void QGLView::clearGLItem(QGLItem *item)
{
    removeDrawables(m_drawableListMap.value(item));
}