Difference between revisions of "Extending TOpenGLControl"

From Free Pascal wiki
(Fix WGL_AUX_BUFFERS_ARB name.)
m (categories)
 
Line 20: Line 20:
  
 
I hope this information helps anyone willing to create a patch :) The job is fairly easy, you can grep e.g. for AlphaBits inside lazarus/trunk/components/opengl/ to see where you need to insert your code. You basically pass down the information to appropriate WGL/GLX routines.
 
I hope this information helps anyone willing to create a patch :) The job is fairly easy, you can grep e.g. for AlphaBits inside lazarus/trunk/components/opengl/ to see where you need to insert your code. You basically pass down the information to appropriate WGL/GLX routines.
 +
 +
 +
[[Category:Graphics]]
 +
[[Category:OpenGL]]

Latest revision as of 05:17, 18 September 2014

Some information that may a useful starting point for someone willing to create a patch to add ColorBits and AuxBuffers and other similar properties to TOpenGLControl:

1. For GLX (GTK), there are two ways to choose context attributes (both have to be supported for now, to support older GLX versions, and to allow multi-sampling on modern GLX versions):

They are both handled by common CreateOpenGLContextAttrList inside glgtkglxcontext.pas, they both support values GLX_RED/GREEN/BLUE_SIZE and GLX_AUX_BUFFERS.

Current implementation sets minimum red/green/blue bits to 1.

2. For WGL (WinAPI), also two ways of choosing context attributes are available, for similar reasons (the modern way has more features, but the older way is 100% universally supported):

Current implementation sets color bits = 24.

Note that you cannot request complete colorbits for GLX (only separate r/g/b bits), and you cannot request separate r/g/b bits for WinAPI with ChoosePixelFormat. Probably we should make separate ColorBitsRed, ColorBitsGreen, ColorBitsBlue properties (as these are more flexible), and for ChoosePixelFormat just pass PIXELFORMATDESCRIPTOR.cColorBits := ColorBitsRed + ColorBitsGreen + ColorBitsBlue.

I hope this information helps anyone willing to create a patch :) The job is fairly easy, you can grep e.g. for AlphaBits inside lazarus/trunk/components/opengl/ to see where you need to insert your code. You basically pass down the information to appropriate WGL/GLX routines.