diff --git a/src/osgParticle/ParticleSystem.cpp b/src/osgParticle/ParticleSystem.cpp index 42cf4f053..175a60e18 100644 --- a/src/osgParticle/ParticleSystem.cpp +++ b/src/osgParticle/ParticleSystem.cpp @@ -394,29 +394,41 @@ void osgParticle::ParticleSystem::drawImplementation(osg::RenderInfo& renderInfo case osgParticle::Particle::HEXAGON: case osgParticle::Particle::QUAD: { - vertices.push_back(xpos-p1-p2); - colors.push_back(color); - texcoords.push_back(osg::Vec2(s_coord, t_coord)); + osg::Vec3 c0(xpos-p1-p2); + osg::Vec2 t0(s_coord, t_coord); + osg::Vec3 c1(xpos+p1-p2); + osg::Vec2 t1(s_coord+s_tile, t_coord); + osg::Vec3 c2(xpos+p1+p2); + osg::Vec2 t2(s_coord+s_tile, t_coord+t_tile); + osg::Vec3 c3(xpos-p1+p2); + osg::Vec2 t3(s_coord, t_coord+t_tile); - vertices.push_back(xpos+p1-p2); - colors.push_back(color); - texcoords.push_back(osg::Vec2(s_coord+s_tile, t_coord)); + // first triangle + vertices.push_back(c0); + vertices.push_back(c1); + vertices.push_back(c2); + texcoords.push_back(t0); + texcoords.push_back(t1); + texcoords.push_back(t2); - vertices.push_back(xpos+p1+p2); - colors.push_back(color); - texcoords.push_back(osg::Vec2(s_coord+s_tile, t_coord+t_tile)); + // second triangle + vertices.push_back(c2); + vertices.push_back(c3); + vertices.push_back(c0); + texcoords.push_back(t2); + texcoords.push_back(t3); + texcoords.push_back(t0); - vertices.push_back(xpos-p1+p2); - colors.push_back(color); - texcoords.push_back(osg::Vec2(s_coord, t_coord+t_tile)); + for (int j = 0; j < 6; ++j) + colors.push_back(color); - if (!primitives.empty() && primitives.back().first==GL_QUADS) + if (!primitives.empty() && primitives.back().first==GL_TRIANGLES) { - primitives.back().second+=4; + primitives.back().second+=6; } else { - primitives.push_back(ArrayData::ModeCount(GL_QUADS,4)); + primitives.push_back(ArrayData::ModeCount(GL_TRIANGLES,6)); } break;