I'm working with an axial billboard implementation and trying to apply a texture to said billboard, but it doesn't appear to be rendering a texture onto the list of triangles that get rendered. The positioning on the billboard seems fine, just... not getting any textures. It's using a custom scene node, and the render code for the material looks like this:
Code: Select all
driver->setTransform(video::ETS_WORLD, mat);
driver->setMaterial(getMaterial(0));
// finally I draw it
driver->drawIndexedTriangleList(vertices, 4, indices, 2);
Code: Select all
node->setMaterialTexture(0, driver->getTexture("assets/effects/laser.png"));
node->setMaterialType(EMT_TRANSPARENT_ADD_COLOR);
node->setMaterialFlag(EMF_LIGHTING, false);
node->setMaterialFlag(EMF_BACK_FACE_CULLING, false);
Code: Select all
video::SColor color = video::SColor(255, 255, 255, 255);
vertices[0].TCoords.set(0.0f, 0.0f);
vertices[0].Color = color;
vertices[1].TCoords.set(1.0f, 0.0f);
vertices[1].Color = color;
vertices[2].TCoords.set(1.0f, 1.0f);
vertices[2].Color = color;
vertices[3].TCoords.set(0.0f, 1.0f);
vertices[3].Color = color;
What's going wrong is that it's just using the color given in the vertices, but I'm at a loss as to how to make it use the texture coordinates instead. This seems to be the same as how a billboard scene node renders a texture. Any advice on what I'm screwing up here?