Hi all,

I'm posting here as I've no where found an answer to my problem. In case 
I overlooked a related topic, I am sorry for asking again.

I am using OpenSG 1.8 in my little starter project.

I want to use particles in mode "Rectangles" (so that I have no 
billboarding effect). Furthermore those particles should display a texture.

That's working in case I am using a texture with only one color. If not, 
something strange happens. See this picture to see what's happening.

http://img688.imageshack.us/img688/2973/effect.png

I'll include parts of my code where the texture gets set right below. I 
think that'd be the crucial part.


//Setting the texture
     osg::SimpleTexturedMaterialPtr mTextureMaterial = 
osg::SimpleTexturedMaterial::create();

     osg::UChar8 imgdata[] =
         {  255,255,0,  255,0,0,
            0,255,0,    0,0,0,
            255,255,255,  255,0,255,
            0,255,255,    0,0,255,
             };

     osg::ImagePtr pImage = osg::Image::create();
     pImage->set(Image::OSG_RGB_PF, 2, 2, 2, 1, 1, 0, imgdata);

     osg::beginEditCP(mTextureMaterial);
     mTextureMaterial->setLit( true );
     mTextureMaterial->setImage( pImage );
     mTextureMaterial->setEnvMode( GL_MODULATE );
     mTextureMaterial->setMagFilter( GL_NEAREST );

   //  osg::BlendChunkPtr bl= osg::BlendChunk::create();
   //  osg::beginEditCP(bl);
         //bl->setSrcFactor(GL_ONE);
         //bl->setDestFactor(GL_ONE);
   //  osg::endEditCP(bl);
   //
   //  mTextureMaterial->addChunk(bl);

     osg::endEditCP(mTextureMaterial);

     m_pData->ptrParticles->setMaterial(mTextureMaterial);

Funnily enough it works correctly in case i am using mode "ViewDirQuads" 
- but that got billboarding which I don't want to use. I somehow have 
the feeling as if the texture doesn't get mapped correctly on the 
"Rectangle". But I'm not sure on that.

So if anyone got any idea what's happening here, feel free to help :-) 
Or if there's another solution for displaying particles with texture 
without billboarding, I am open for everything :-)

Kind regards,

Markus

------------------------------------------------------------------------------

_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to