thanks for implementing the draw2DVertexPrimitiveList() function we needed in SuperTuxKart. And while it works in cases that we don't need a texture, I can't get it to do what I want if I need a texture:
In the lower right corner will be a speedometer (not shown in the picture to make the problem more obvious), and the yellow line is from a texture which is used to indicate the speed. Unfortunately I can't get rid of the white triangle(s), which is where the texture has transparency. Here the code I am using:
Code: Select all
video::S3DVertex vertices[4];
vertices[0].TCoords = core::vector2df(1.0f, 1.0f);
vertices[0].Pos = core::vector3df((float)meter_pos.LowerRightCorner.X,
(float)meter_pos.LowerRightCorner.Y,
0);
...
// Setting of the remaining vertices skipped, the values appear to be all fine
...
short int index[4]; // Note: count is either 3 or 4
for(unsigned int i=0; i<count; i++)
{
index[i]=i;
vertices[i].Color = video::SColor(255, 255, 255, 255);
}
video::SMaterial m;
m.setTexture(0, m_speed_bar_icon->getTexture());
irr_driver->getVideoDriver()->setMaterial(m);
irr_driver->getVideoDriver()->draw2DVertexPrimitiveList(vertices, count,
index, count-2, video::EVT_STANDARD, scene::EPT_TRIANGLE_FAN);
I could get it to work by modifying the implementation of draw2DVertexPrimitiveList:
Code: Select all
setRenderStates2DMode(false, (Material.getTexture(0) != 0), false);
Code: Select all
setRenderStates2DMode(false, (Material.getTexture(0) != 0), true);
Is there a way to get the same effect (only show the texture with transparency, but not the actual triangle) without patching irrlicht?
Thanks!
Joerg
Edit: Should have mentioned it: that's with the OpenGL driver.