Direct3D Z order question

Stefan Dösinger stefandoesinger at
Sun Feb 12 03:37:41 CST 2006

> Err reading your e-mail again, pardon my directx ignorance, but aren't
> all d3d z values supposed to be in the [0.0, 1.0] range? I thought that
> was the range for the z buffer. I recall reading that one of the main
> annoyance differences between OpenGL and D3D was OpenGL used [-1.0, 1.0]
> for depth and D3D used [0.0, 1.0].

I've found the reason for the problems in half-life: HL draws with 2 different 
viewports, one with z...[0.0, 1.0], and another one with z...
[]. WineD3D calls glOrtho with the current viewport on the 
first draw with processed vertices, then it stores that the viewport is set  
and avoids the glOrtho call. ProcessVertices always uses the current 
viewport. So the Vertices processed with the [0.0, 0.53333...] viewport were 
drawn into the [0.0, 1.0] viewport. Setting the glOrtho after a viewport 
change fixed the problem.

The HL Direct3D engine is now working fine :). I'll get a few more games 
running, then I can start sending patches :) :)
(Well, two bugs remain: Decals are flickering, and hl changes the screen 
resolution back to 640x480 for some reason. And it's quite slow)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url :

More information about the wine-devel mailing list