LPDIRECT3DDEVICE::DrawPrimitiveUP只绘制黑白
LPDIRECT3DDEVICE::DrawPrimitiveUP only drawing in black and white
struct tri_vertex
{
float x, y, z, h;
D3DCOLOR color;
};
void Draw2DLine(float x1, float y1, float x2, float y2, D3DCOLOR dwColor)
{
tri_vertex vertices[2] =
{
x1, y1, 0.0f, 1.0f, dwColor,
x2, y2, 0.0f, 1.0f, dwColor,
};
pDevice->DrawPrimitiveUP(D3DPT_LINELIST, 1, vertices, sizeof(tri_vertex));
}
pDevice->SetRenderState( D3DRS_ZENABLE, D3DZB_TRUE );
pDevice->SetRenderState( D3DRS_LIGHTING, false );
pDevice->SetTexture( NULL, NULL );
pDevice->SetPixelShader( NULL );
// If commented out, the block drawn is black. Otherwise its completely white.
pDevice->SetVertexShader( NULL );
// For transparency
pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
pDevice->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_SRCALPHA);
pDevice->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_INVSRCALPHA);
pDevice->SetRenderState(D3DRS_BLENDOP,D3DBLENDOP_ADD);
pDevice->SetFVF(D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1);
我试图用DrawPrimitiveUP()画一条简单的线。然而,绘制的线是完全黑色或白色,这取决于SetVertexShader是否为空。它也不支持透明
然而,绘制的线要么完全是黑色的,要么完全是白色的SetVertexShader为null
你想要什么?彩色的线吗?线条的颜色设置好了吗?
它也不支持透明
您将纹理设置为null,因此混合对线条没有影响。
相关文章:
- OpenCV EqualizeHist()从彩色图像创建黑白图像
- QuadTree只在窗口的右上角绘制
- 绘制旋转的三角形
- flutter:即使shouldRepaint()返回true,自定义画家也不会重新绘制
- 如何在QT中的自定义视频小工具t上绘制矩形
- 如何在Visual Basic中使用矩形函数OpenGL绘制矩形
- 无法使用VAO和EBO(openGL)绘制多个对象
- 为什么我的点没有在 OpenGL 中绘制鼠标所在的位置?
- 绘制顺时针三角形,重新排序点
- 在顶点着色器中使用 OpenGl 的未声明标识符,我在顶点着色器中绘制三角形时遇到问题
- SFML 文本未绘制在窗口上
- 如何在快板的屏幕中显示子位图的绘制?
- 如何绘制自定义形状的元素?
- QPainter 将 QBrush 设置为 在 QT/C++ 中绘制文本
- 除非重新绘制大小,否则SDL_Texture在调整大小后呈现黑色
- 绘制文本问题
- 在 QT C++中绘制/操作多边形
- 如何在 Gnuplot 中分别绘制 2 个文件数据?我有一个文件"sin.txt",另一个文件"cos.txt",我想将它们分别绘制在一个图表上
- 在现代OpenGL中,绘制GL_TRIANGLE奇怪的z轴行为的填充圆
- LPDIRECT3DDEVICE::DrawPrimitiveUP只绘制黑白