Hello,
I’d like to use point sprites in my program. I see the quads when I use
the drawBillboard() method but they are not textured. Here is my code:
vec4 psPos[NBR_POINT_SPRITES];
TextureRef psTex;
(…)
for (int i = 0; i < NBR_POINT_SPRITES; ++i)
{
double x = -2. + (rand() % 40) * .1f;
double y = (rand() % 120) * .1f;
double z = -2. + (rand() % 40) * .1f;
double speed = (rand() % 20) * .1f;
psPos[i] = vec4(x, y, z, speed);
}
psTex = Texture2d::create(loadImage("data/ps.png"));
(…)
vec3 mRight, mUp;
viewCam.getBillboardVectors(&mRight, &mUp);
gl::enableAlphaBlending();
gl::color(ColorA(1.f, 1.f, 1.f, .75f));
psTex->bind(); // bind the point sprites texture
for (int i = 0; i < NBR_POINT_SPRITES; ++i)
{
gl::drawBillboard(vec3(psPos[i].x, psPos[i].y, psPos[i].z), vec2(.25f, .25f), 0.f, mRight, mUp);
}
psTex->unbind();
gl::disableAlphaBlending();
Any help will be appreciated,
azerty69