Hello,
I have written a small Direct3D7 test application which draws two overlapping triangles, a red one and a blue one. The red triangle has the z value 0.0 (closest to the viewer), the blue one 1.0(far away). Strangely, the blue triangle overlaps the red one on Windows.
The same happens on the current ddraw implementation, but in WineD3D the red triangle overlaps the blue one, which is mathematically correct. I've studied the ddraw and wined3d drawing code over and over, but I couldn't find any difference. It seems that on Windows, the triangle that is drawn last overlaps the other one in the output, and the z value seems to be ignored completely. Can someone explain me what's going on here????
The reason for this is the Direct3D mode of Half-Life 1. I've got it working with WineD3D after a long struggle with IDirect3DVertexBuffer::ProcessVertices, except of the HUD, which is hidden. If I force the z value in the [0.0, 1.0] range, it is shown, but the rest is broken obviously.
How to run my test program: I've attached a source file and a Makefile which builds a .exe with mingw, and a precompiled exe file. When you run it, it shows a black screen, and if you click anywhere, it draws the triangles. I've some bug in the flipping code, so you have to click two times actually. Pressing esc exits.
Thanks, Stefan
PS: If anyone needs the d3d7->wined3d code to look at, I can send patches. But it's quite messy now ;)