Hello,
perhaps anyone can help me with the texturizing of my point sprites. -
what is wrong?
To have a single textured Point Sprite i tried this here:
1. i defined a TextureChunkPtr, loaded a texture, set it per
...->setPointSprite(bool b) true
2. i defined a BlendChunkPtr, gave properties
3. i defined a PointChunkPtr, set it per ...->setSprite(bool b) true
4. i created a ChunkMaterialPtr, to bundle the properties
5. i defined a GeometryPtr with: GeoPTypesPtr(GL_POINT),
GeoPLengthsPtr(1), GeoPositions3fPtr(x,y,z)
6. i created a NodePtr, set the core with the given geometry
In the result i have a black square with no texture.
- why is that so? have i forgotten something?
- is it at all possible to texturize point sprites?
would be nice, if anybody helped - thanx - MartiN
Here is the code:
/*###########################################################*/
ImagePtr image = Image::create(); // material
image->read("textures/dummy_tex.tga");
TextureChunkPtr texChunk = TextureChunk::create();
beginEditCP(texChunk);
{
texChunk->setEnvMode(GL_MODULATE);
texChunk->setMinFilter(GL_LINEAR_MIPMAP_LINEAR);
texChunk->setMagFilter(GL_LINEAR);
texChunk->setScale(true);
texChunk->setImage(image);
texChunk->setPointSprite(true);
}
endEditCP(texChunk);
BlendChunkPtr blendChunk = BlendChunk::create();
beginEditCP(blendChunk);
{
blendChunk->setAlphaValue(0.2f);
blendChunk->setAlphaFunc (GL_GEQUAL);
blendChunk->setSrcFactor (GL_SRC_ALPHA);
blendChunk->setDestFactor(GL_ONE_MINUS_SRC_ALPHA);
}
endEditCP(blendChunk);
PointChunkPtr pointChunk = PointChunk::create();
beginEditCP(pointChunk);
pointChunk->setSprite(true);
pointChunk->setSize(100);
endEditCP(pointChunk);
ChunkMaterialPtr material = ChunkMaterial::create();
beginEditCP(material);
material->addChunk(pointChunk);
material->addChunk(texChunk);
material->addChunk(blendChunk);
endEditCP(material);
GeoPTypesPtr type = GeoPTypesUI8::create(); // geo
GeoPLengthsPtr length = GeoPLengthsUI32::create();
GeoPositions3fPtr pos_sprite = GeoPositions3f::create();
beginEditCP(pos_sprite);
pos_sprite->addValue(Pnt3f( 1000 , 1000 ,1000 ));
endEditCP(pos_sprite);
beginEditCP(type);
type->addValue(GL_POINT);
endEditCP(type);
beginEditCP(length);
length->addValue(pos_sprite->getSize());
endEditCP(length);
GeometryPtr spriteGeo = Geometry::create();
beginEditCP(spriteGeo);
{
spriteGeo->setTypes(type);
spriteGeo->setLengths(length);
spriteGeo->setPositions(pos_sprite);
spriteGeo->setMaterial(material);
}
endEditCP(spriteGeo);
// ... add node to the scene
/*###########################################################*/-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users