Direct3D Z order question

Joseph Garvin k04jg02 at
Sun Feb 12 12:54:14 CST 2006

Stefan Dösinger wrote:

>>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...
2 different viewports or just two different projection matrix settings? 
The way 2D overlays are handled in OpenGL from my (very limited) 
experience is that you setup your normal glPerspective, and then once 
you've drawn everything in the world, you switch to a glOrtho2D and do 
whatever 2D drawing you want on top. GL viewports just specify what what 
pixels in the window OpenGL has control over... if they use two whole 
different viewports instead of just changing projection settings that 
either strikes me as really dumb or that they're doing some black magic 
I don't know about ;)

Unless the viewport and the projection matrix are tied together in 
DirectX? If so there's a possible optimization in having the DirectX 
viewport function call check if everything that would be passed to 
glViewport is the same and if so only make the appropriate 
glOrtho/glPerspective call. I'm not sure how expensive a glViewport call is.

More information about the wine-devel mailing list