Discussion:
OpenGL 3.3 Core
(too old to reply)
Mathias
2017-05-21 20:38:05 UTC
Permalink
Raw Message
Is there an option with Lazarus own board means to activate the OpenGL
3.3 core mode. Or is it enough for me to do the following?

OpenGLControl.OpenGLMajorVersion := 3;
OpenGLControl.OpenGLMinorVersion := 3;

Mfg Mathias


_______________________________________________
fpc-devel maillist - fpc-***@lists.freepascal.org
http://li
Michalis Kamburelis
2017-05-26 09:51:43 UTC
Permalink
Raw Message
Is there an option with Lazarus own board means to activate the OpenGL 3.3
core mode. Or is it enough for me to do the following?
OpenGLControl.OpenGLMajorVersion := 3;
OpenGLControl.OpenGLMinorVersion := 3;
These TOpenGLControl properties are passed to the underlying API to
indicate that you want a context that supports this specific OpenGL
version. So, yes, this is the way to get OpenGL 3.3 context.

However, it's not implemented on all platforms. As far as I see, only
the GTK widgetset actually uses the Major/MinorVersion, other
widgetsets simply ignore it.

But in practice, you will also get a 3.3 context without requesting
it, if your OpenGL supports it, and it has ARB_compatibility. See
https://www.khronos.org/opengl/wiki/Core_And_Compatibility_in_Contexts
about the gory details.

Regards,
Michalis
_______________________________________________
fpc-devel maillist - fpc-***@lists.freepascal.org
http://lists.freepascal.org/cgi-bin
Kostas Michalopoulos
2017-05-26 16:48:45 UTC
Permalink
Raw Message
I'd use an enum with values like (glcDefaultProfile, glcCoreProfile,
glcCompatibilityProfile). Default would leave things as-is (when versioning
is introduced to backends that currently do not support it, it will either
use a backend-specific default or leave it unspecified where possible),
Core will explicitly request a core profile and Compatibility will
explicitly request a compatibility profile. Under OSes where compatibility
isn't available, the context creation would fail.

For bonus points, i'd rename glcCoreProfile to glcRequireCoreProfile and
instead of glcCompatibilityProfile i'd use glcPreferCompatibilityProfile
and glcRequireCompatibilityProfile. glcRequireCoreProfile would work like
above, glcPreferCompatibilityProfile will first try to use the
compatibility profile but fallback to core if not available (so that the
drivers avoid the extra checks) and glcRequireCompatibilityProfile will
fail if the compatibility profile doesn't exist - basically having the
profiles as glcDefaultProfile, glcPreferCompatibilityProfile,
glcRequireCompatibilityProfile and glcRequireCoreProfile.
On Fri, 26 May 2017 18:21:47 +0300
[...]
I think the control should gain a Profile attribute to solve this.
How would that "Profile attribute" look like?
And
while at it, also a ForwardCompatible attribute for debugging (forward
compatible contexts disable any deprecated functionality, but they can
also
slow down rendering due to extra tests, so they are only good for
debugging
code).
Mattias
_______________________________________________
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Michalis Kamburelis
2017-05-28 23:49:47 UTC
Permalink
Raw Message
Post by Kostas Michalopoulos
I'd use an enum with values like (glcDefaultProfile, glcCoreProfile,
glcCompatibilityProfile). Default would leave things as-is (when versioning
is introduced to backends that currently do not support it, it will either
use a backend-specific default or leave it unspecified where possible), Core
will explicitly request a core profile and Compatibility will explicitly
request a compatibility profile. Under OSes where compatibility isn't
available, the context creation would fail.
For bonus points, i'd rename glcCoreProfile to glcRequireCoreProfile and
instead of glcCompatibilityProfile i'd use glcPreferCompatibilityProfile and
glcRequireCompatibilityProfile. glcRequireCoreProfile would work like above,
glcPreferCompatibilityProfile will first try to use the compatibility
profile but fallback to core if not available (so that the drivers avoid the
extra checks) and glcRequireCompatibilityProfile will fail if the
compatibility profile doesn't exist - basically having the profiles as
glcDefaultProfile, glcPreferCompatibilityProfile,
glcRequireCompatibilityProfile and glcRequireCoreProfile.
I like all of these ideas:)

And they are easily implementable by
https://www.khronos.org/registry/OpenGL/extensions/ARB/GLX_ARB_create_context.txt
(used by the GTK implementation):

- glcRequireCoreProfile and glcRequireCompatibilityProfile results in
the appropriate bit set of GLX_CONTEXT_PROFILE_MASK_ARB .
- glcPreferCompatibilityProfile would need to eventually query for
another profile, as you write (I'm not sure do we really need it much?
I see that sometimes it can be useful, if the implementation can adapt
to use either "old fixed-function renderer" or not, but I'm not sure
is this a large need.)
- ForwardCompatible = true sets the
GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB bit in GLX_CONTEXT_FLAGS_ARB .

Not that I'm volunteering to implement them (I'm not having much time,
and I mostly use my own OpenGL context creation in CastleWindow). But
it makes sense and I would gladly test it:)

Regards,
Michalis
_______________________________________________
fpc-devel maillist - fpc-***@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/ma

Loading...