Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2013-01

TOpenGLControl.DepthBits default value

6 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Reimar Grabowski

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.

R.

Reply by email

Michalis Kamburelis
to Reimar Grabowski
Reimar Grabowski wrote 9 lines
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

Reply by email

Kostas Michalopoulos
to Michalis Kamburelis

AFAIK even if you ask for 24 and there is no support for it, you'll get a 16bit buffer anyway.

On Wed, Jan 23, 2013 at 12:21 AM, Michalis Kamburelis <

Show quoted text 42 lines
wrote: 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<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 -- ______________________________**_________________ Lazarus mailing list .**freepascal.org http://lists.lazarus.**freepascal.org/mailman/**listinfo/lazarus<http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130123/bdcef545/attachment.html>

Reply by email

Reimar Grabowski
to Michalis Kamburelis: Before my patch on http://bugs.freepascal.org/view.php?id=22170 the depth bits were…

On Wed, 23 Jan 2013 00:21:44 +0100
Michalis Kamburelis wrote:

First of all thanks for the explanation.

Show quoted text 5 lines
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).

Well "really, really ancient" is the correct term and in my experience 3D on virtual machines even if supported is not really that useful.

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.

This I think is absolutely correct as the stencil buffer is only used for special/advanced stuff that in general not many people need. And if they do they should know how to get one.

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.

I think that it would be good for people new to OpenGL to give them the better depth buffer precision as default. Z-Fighting and other nasty stuff happens much earlier on the lower precision one. Personally I can live with the 16 bit default as well. It is just a slight inconvenience that I have to change it for every new project. So I vote for 24 as default.

R.

Reply by email

Kostas Michalopoulos
to Michalis Kamburelis: No. This is a required minimal value, at least for GLX and modern…

Ah, interesting. I probably had ChoosePixelFormat in mind which from what i remember tries to get a close format and falls back to whatever is available if it cannot find one.

On Wed, Jan 23, 2013 at 4:48 PM, Michalis Kamburelis <

Show quoted text 23 lines
wrote: Kostas Michalopoulos wrote: > AFAIK even if you ask for 24 and there is no support for it, you'll get > a 16bit buffer anyway. > > No. This is a required minimal value, at least for GLX and modern wglChoosePixelFormatARB. It was *possibly* treated in more relaxed way by the old ChoosePixelFormat, but you should not depend on that. Links to relevant docs are on http://wiki.freepascal.org/**Extending_TOpenGLControl<http://wiki.freepascal.org/Extending_TOpenGLControl>. Michalis -- ______________________________**_________________ Lazarus mailing list .**freepascal.org http://lists.lazarus.**freepascal.org/mailman/**listinfo/lazarus<http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130124/10f5f960/attachment.html>

Reply by email