[Lazarus] RE : RE : New widgetset

Michalis Kamburelis michalis.kambi at gmail.com
Tue Aug 16 21:38:42 CEST 2011


Ludo Brands write:
> The all or nothing approach in Load_GL_version_X_Y (all functions are
> present or fail) is simple but has its disadvantages when working with third
> party libraries. Fe Synapse uses a more elaborate method of loading
> functions at runtime. It defines for every function a wrapper that checks if
> the function pointer is assigned and then calls it or raises a meaningfull
> exception.
>

When an entry point is nil, the error message is more or less clear if
you can read the backtrace :) The real trouble is that defining such
"stub" versions for all the functions would be unmaintainable IMHO, as
there are a *huge* number of GLExt functions, with various parameters.
That's a lot of work, only to deal with inferior OpenGL
implementations.

Maybe all the Assigned() checks could be moved lower, so that
everything possible is still loaded, even when Load_GL_version_x_x
returns false. Although this will still be risky: the programs that
want to play safe should just assume that you really don't have
(correct) OpenGL 2, and just don't use any of it's functions, if some
entry point failed, IMHO.

GLSL shaders are also available through ARB extensions, and this is a
good fallback that works in practice, in my experience. (For example,
my fglrx lies about OpenGL 2 too, but it has valid ARB_shader_objects
and friends.) So using GLSL shaders even with these broken
implementations is possible. However nvidia-widgetset doesn't use
ARB_shader_xxx. Understandably, nvidia-widgetset assumes a correct
OpenGL implementation, and I have indeed never seen nvidia OpenGL
lying about it's version (fglrx, and some latest Intel, lie all the
time on the other hand..)

Michalis




More information about the Lazarus mailing list