void CPUSkinningAlgorithm::drawPrimitives(
    SkinnedGeometry *skinGeo, CPUSkinningDataAttachment* data, DrawEnv *pEnv)
{
    // store glColor.
    Color4f color;

#if !defined(OSG_OGL_COREONLY) || defined(OSG_CHECK_COREONLY)
    if(skinGeo->getColors() != NULL)
        glGetFloatv(GL_CURRENT_COLOR, color.getValuesRGBA());
#endif

    GeoPumpGroup::PropertyCharacteristics prop =
        GeoPumpGroup::characterizeGeometry(skinGeo);

    GeoPumpGroup::GeoPump pump = GeoPumpGroup::findGeoPump(pEnv, prop);

    if(pump != NULL)
    {
        pump(pEnv,
             skinGeo->getLengths(),      skinGeo->getTypes(),
             data   ->getMFProperties(), skinGeo->getMFPropIndices());
    }
    else
    {
        SWARNING << "CPUSkinningAlgorithm::drawPrimitives: no GeoPump found "
                 << "for SkinnedGeometry " << skinGeo
                 << std::endl;
    }

#if !defined(OSG_OGL_COREONLY) || defined(OSG_CHECK_COREONLY)
    // restore glColor.
    if(skinGeo->getColors() != NULL)
        glColor4fv(color.getValuesRGBA());
#endif
}
Beispiel #2
0
void Geometry::drawPrimitives(DrawEnv *pEnv)
{
    bool          usesShader = false;
    
    //usesShader = (pEnv->getActiveShader() != 0);
    
    // store glColor.
    Color4f color;

    if(getColors() != NULL)
        glGetFloatv(GL_CURRENT_COLOR, color.getValuesRGBA());

    if(getDlistCache() == true)
    {
        Int32 glid;

        if(usesShader)
        {
            glid = getAttGLId();
        }
        else
        {
            glid = getClassicGLId();
        }

        pEnv->getWindow()->validateGLObject(glid, pEnv);
        glCallList(pEnv->getWindow()->getGLObjectId(glid));
    }
    else
    {
        GeoPumpGroup::PropertyCharacteristics prop;

        prop = GeoPumpGroup::characterizeGeometry(this);

        if(usesShader)
            prop |= GeoPumpGroup::UsesShader;

        GeoPumpGroup::GeoPump pump;
        pump = GeoPumpGroup::findGeoPump(pEnv, prop);

        if (pump)
        {
            pump(pEnv, this);
        }
        else
        {
            SWARNING << "Geometry::drawPrimitives: no Pump found for geometry "
                     << this
                     << std::endl;
        }
    }

    // restore glColor.
    if(getColors() != NULL)
        glColor4fv(color.getValuesRGBA());


    StatCollector *coll(pEnv->getAction()->getStatCollector());
    if(coll != NULL)
    {
        StatIntElem *el(coll->getElem(RenderAction::statNGeometries,false));
        if(el)
        {
            el->inc();
        }
    }
}