SFML community forums
General => Feature requests => Topic started by: kire on November 28, 2010, 01:12:51 pm
-
In SFML 2.0, is there any plan to add a context setting to enable a forward compatible context? As I am developping on cutting edge and future-minded I really could use those.
I know how to create such contexts myself using wgl or glx (the two platforms I'm developping for most) but I'd rather see it wrapped in a decent cross-platform media API like SFML.
also, related: are OpenGL 4 and 4.1 contexts supported without problem? (I'm not getting my new gpu for another 2 weeks so can't test myself).
Kind regards
-
Appearantly you even set the compatibility by default, which I think is great :).
However, concerning 4.x support I think this doesn't really work as expected, your 'release try' currently happens as follows:
while (!myContext && (mySettings.MajorVersion >= 3))
{
//Try create context
// If we couldn't create an OpenGL 3 context, adjust the settings
if (!myContext)
{
if (mySettings.MinorVersion > 0)
{
// If the minor version is not 0, we decrease it and try again
mySettings.MinorVersion--;
}
else
{
// If the minor version is 0, we decrease the major version and stop with 3.x contexts
mySettings.MajorVersion = 2;
}
}
}
So if it cannot create a 4.1/4.0 context it will immediately fall back to 2.x, which shouldn't really happen. I added some methods to the more general GLContext and adapted the glx and wgl context classes accordingly. I think this fix is more future proof. Anyway, you can find the patch here (https://sourceforge.net/tracker/?func=detail&aid=3121284&group_id=188964&atid=927429)
I know there are some weird looking +/- lines in the fix also, I guess that has something to do with line endings getting changed upon saving.
-
Thanks for the patch, but I think it's too complicated. I can simply decrement the major version like I do with the minor version, instead of setting it to 2.
-
Well, I actually tried that way first because it's obviously easier, however there is no clear way of going from 4.0->3.3 with that method. That's why I came up with the versions array (the method is simply because I think it's tidier to reuse in multiple impl versions). And with this implementation adding support to a new version is simply done by adding it to an array, given of course that opengl's createcontext method doesn't change again :p.
Anway, thanks for looking at it :).
-
there is no clear way of going from 4.0->3.3
Is it necessary? Creating a 3.x (for x > 3) context will fail, until we get to 3.3. This way we don't have to manually hard-code all the valid version numbers.
-
Ah so you would go from 4.0 to something like 3.9? I guess that will also work, yes :).
-
Sorry to bump this but will this be implemented any time soon? I would like to be able to call setting.SetLowestGLVersion(3.3); Or at least something similar.
Regards,
Brent
-
Choosing the GL version of the context is already implemented. Are you talking about something else?
-
Choosing the GL version of the context is already implemented. Are you talking about something else?
Oh it is? Sorry maybe I read this thread wrong. How do I use it?
-
How do I use it?
You read the doc ;)
http://www.sfml-dev.org/documentation/2.0/structsf_1_1ContextSettings.php
-
Hmm, couldnt you make that fancy loop go up until it finds a not supported version?
like
*increment major version until not supported*
*take last supported major version*
*increment minor version until not supported*
*use last working minor version with the major version*
-
Hmm, couldnt you make that fancy loop go up until it finds a not supported version?
like
*increment major version until not supported*
*take last supported major version*
*increment minor version until not supported*
*use last working minor version with the major version*
Because if we pick context version "3.3" but the computer only support 2.0, we are screwed to say the least. Unless you remove the possibility to choose a version for the user. I'm not experienced enough with OpenGL to make a call on that, I don't know any reason why you would rather want an older context than the newest as the "highest" version for an application.
Think it would be better if SFML provided a way to check if a context setting is valid before sending it to the window to do custom things like you want.