[Lazarus] TOpenGLControl.DepthBits default value

Michalis Kamburelis michalis.kambi at gmail.com
Wed Jan 23 00:21:44 CET 2013


Reimar Grabowski wrote:
> Hi,
>
> the in the topic mentioned property defaults to a value of 16. Is
> there any special reason for it? IMHO the default value should be 24.
> After all it's 2013 and not 1998.
>
> It's not really a problem, I just want to know the reason why this
> value was chosen.
>

Before my patch on http://bugs.freepascal.org/view.php?id=22170 the 
depth bits were hardcoded (16 on WinAPI and 1 on GLX). So I set the 
default value for TOpenGLControl.DepthBits at safe 16.

The general idea is that TOpenGLControl has safe default values, that 
are guaranteed to work (and be fast) even on really really ancient 
graphic cards or when the system is running under virtual machine (which 
often means you don't get hardware-accelarated 3D until you explicitly 
install/enable something). For the same reason e.g. 
TOpenGLControl.StencilBits is by default 0, even though all modern GPUs 
can give you at least 8-bit stencil buffer.

Other APIs to get OpenGL context, like GtkGLExt or Glut or low-level 
WinAPI or GLX follow the same convention. The defaults are very 
conservative.

That said, I would be personally fine with changing this default to 24, 
if others think it's a good idea. A developer can always lower it to 16 
when that's enough. So, I don't really have a strong preference about it.

Michalis




More information about the Lazarus mailing list