gl_ztrick ?

Discuss programming topics for the various GPL'd game engine sources.
Post Reply
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

gl_ztrick ?

Post by Baker »

Lately, I've been trying to understand the purpose of gl_ztrick.

As far as I can tell, DarkPlaces does not use this.
From planetquake.com/console

If this toggle is enabled the game will not clear the z-buffer between frames. This will result in increased performance but might cause problems for some display hardware.
Is gl_ztrick necessary in the modern world? Does make anything significantly faster?

Although I don't have any problems with it, I've read that some people have issues with it with, say, those Intel Integrated Media display adapters.
Sajt
Posts: 1215
Joined: Sat Oct 16, 2004 3:39 am

Post by Sajt »

It's about 10 years obsolete, I'd say. Depth clears aren't exactly expensive these days. QuakeWiki says TNT2 and newer cards should leave it off, and it comes as no surprise that a crusty old hack would be cut out of any decent modified Quake engine.
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Post by Baker »

Cool ;)

Of the video card problems I've seen and heard about, gl_ztrick is the source of many of them. Especially since it defaults to 1.

I've read about this causing problems in Qrack and ezQuake with some video cards.

/Noticed FitzQuake has gl_ztrick removed as well.
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Post by Spike »

modern graphics cards feature optimisations which only work with ztrick disabled, as well as faster buffer clears.
This means that you'll get one to three percent better framerates with ztrick disabled. Coupled with the driver issues, all modern engines should at least default to it being off.

Its a funky trick though, and can be found in a large number of early GL applications... At least quake based ones!
mh
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Post by mh »

Agreed, there's no need to keep it at all. Removing it will also give you a higher precision depth buffer.
Post Reply