SFML community forums
General => Feature requests => Topic started by: ZHAOPeng on July 14, 2010, 08:59:01 am
-
Hello,
I find that no option for context flag and profile version can be used in SFML 2.0 snapshot.
It is very easy to add them to ContextSettings and the attributes list for creating context.
I hope these two options could be added in the next release so that we can change the profile version for OpenGL 3.2 or later.
Thanks!
ZHAO Peng :wink:
-
What exactly are the "context flag" and the "profile version"?
-
http://www.opengl.org/registry/specs/ARB/glx_create_context.txt
The OpenGL 3.2 introduces the profile mechanism. Each profile is one subset of full OpenGL API. Now there are two profiles: core profile and compatibility profile. The core profile removes lost of old functions. And the compatibility profile could be compatible with any old OpenGL versions.As a result, when create an OpenGL context, the profile should be specified.
Besides, there are two context flag:
GLX_CONTEXT_DEBUG_BIT_ARB and GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB
"If the GLX_CONTEXT_DEBUG_BIT_ARB flag bit is set in
GLX_CONTEXT_FLAGS_ARB, then a <debug context> will be created. Debug
contexts are intended for use during application development, and
provide additional runtime checking, validation, and logging
functionality while possibly incurring performance penalties. The
additional functionality provided by debug contexts may vary
according to the implementation(fn). In some cases a debug context
may be identical to a non-debug context.
If the GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB is set in
GLX_CONTEXT_FLAGS_ARB, then a <forward-compatible> context will be
created. Forward-compatible contexts are defined only for OpenGL
versions 3.0 and later. They must not support functionality marked
as <deprecated> by that version of the API, while a
non-forward-compatible context must support all functionality in
that version, deprecated or not."
The profile and flag should be set in the attribute list, which is the last parameter of glXCreateContextAttribsARB.
So just add two options to ContextSetting and set them into the attribute list before calling glXCreateContextAttribsARB.
I have modified the SFML 2.0 snapshot and it works fine for me.
Thanks!
-
It would probably not be a good idea to provide these options, as SFML still uses old/deprecated OpenGL functions.
Rendering would be totally broken with the core profile / without the compatibility flag (I'm not sure I understand the difference between these two).
-
I'd prefer if you still offered these as an option, but include a warning in the documentation that it may cause problems if SFML-Graphics is used with incorrect flags.
-
Yes, I'll definitely think about that for SFML 2.0.
-
I'd prefer if you still offered these as an option, but include a warning in the documentation that it may cause problems if SFML-Graphics is used with incorrect flags.
I agree. It is time to remove the deprecated OpenGL functions and move forward to the core profile. Although it can not be finished at one blow, we should start.
Yes, I'll definitely think about that for SFML 2.0.
Thanks for your attention!
-
It is time to remove the deprecated OpenGL functions and move forward to the core profile
You mean in SFML? This is impossible. I would have to implement two (or more) totally different rendering paths, which is a huge amount of work. Maybe for SFML 3.0 ;)
-
if you were to make a flexible rendering abstraction (as Ogre or Irrlicht use), I am sure someone would take over writing a GL3 or a GLES backend.
-
This is a goal that I definitely want to reach. Using GL3 internally won't make a big difference, but GLES is mandatory for porting SFML to mobile devices.
The abstraction is already much better in SFML 2 than in SFML 1, but there's still a lot to do. It requires major modifications in the graphics module, so I keep that for later (maybe SFML 3 :D).
-
Is there still a plan to add support to this feature to context creation in SFML2 when not using the Graphics module? I'd also like to take the opportunity and suggest that it be made possible to create debug context's too.
-
Yes, it's still planned.