Direct3D Z order question

Stefan Dösinger stefandoesinger at
Sun Feb 12 14:01:13 CST 2006

> 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
It's 2 different viewports, and constantly changing world and view matrices. 
The projection matrix is the idendity matrix every time.

The view, projection and world matrix for GL drawing are idendity matrices in 
this case, because processed vertices are drawn(they are in viewport 
coordinates). WineD3D does a check if a glOrtho call is necessary.

I don't know much about GL drawing, but I noticed that GL clips primitive 
parts that are outside the Z range. So if vertices that were processed into a 
[0,5.3333] Z range are drawn into a [0,1.0] viewport leads to missing 
vertices. I guess I have to attend a few more courses at univertiy to really 
understand what exactly is going on.

The relevant code is at dlls/wined3d/drawprim.c, line 186, vtx_transformed is 
true, useVS and vtx_lit are false.

-------------- 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