|
代码如下:
void CMrFaceGroup::Init()
{
m_pGeomNode = new CMrBaseGeode();
m_pGeomNode->setDataVariance(osg::Object:YNAMIC);
addChild(m_pGeomNode);
osg::StateSet* state = m_pGeomNode->getOrCreateStateSet();
//osg::StateSet* state = new osg::StateSet;
state->setMode(GL_BLEND, osg::StateAttribute::OFF);
state->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
state->setMode(GL_DEPTH_TEST, osg::StateAttribute::ON);
m_pTexture1D = new osg::Texture1D;
m_pTexture1D->setWrap(osg::Texture1D::WRAP_S, osg::Texture1D::CLAMP);
m_pTexture1D->setWrap(osg::Texture1D::WRAP_T, osg::Texture1D::CLAMP);
m_pTexture1D->setFilter(osg::Texture1D::MIN_FILTER, osg::Texture1D::NEAREST);
m_pTexture1D->setFilter(osg::Texture1D::MAG_FILTER, osg::Texture1D::NEAREST);
m_pTexture1D->setResizeNonPowerOfTwoHint(false);
osg::ref_ptr<osg::Image> pImage = CreateImage();
if (pImage != NULL)
{
m_pTexture1D->setImage(pImage);
}
state->setTextureAttribute(0, m_pTexture1D, osg::StateAttribute::OVERRIDE);
state->setTextureMode(0, GL_TEXTURE_1D, osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE);
state->setTextureMode(0, GL_TEXTURE_2D, osg::StateAttribute::OFF | osg::StateAttribute::OVERRIDE);
state->setTextureMode(0, GL_TEXTURE_3D, osg::StateAttribute::OFF | osg::StateAttribute::OVERRIDE);
osg::Material* material = new osg::Material;
state->setAttribute(material, osg::StateAttribute::OVERRIDE);
m_pGeomNode->setStateSet(state);
}
为什么不能上传图片? |
|