SFML community forums

General => General discussions => Topic started by: PixelMuffin on September 06, 2012, 05:45:20 am

Title: Any workaround for Lion OpenGL 3.2 Support?
Post by: PixelMuffin on September 06, 2012, 05:45:20 am
I read the thread about Laurent eventually removing deprecated functions from the 2.x code.

This is the thread started about a year ago on github: https://github.com/SFML/SFML/issues/84

I was curious.

1. Are we any closer to being able to support OpenGL 3.2 on Mac OSX?
2. If not, is there any workaround? What if I just use SFML for Window creation. Does that still utilize deprecated functions?

Does anyone have OpenGL 3.2 running with SFML on a Mac?

Thanks and I apologize if I have misunderstood anything. I always try to do my research before posting.

Cheers!
Title: Re: Any workaround for Lion OpenGL 3.2 Support?
Post by: Hiura on September 06, 2012, 08:18:19 am
1/ Removing deprecated stuff is targeted for SFML 2.x, i.e. it's not the highest priority-task.

2/ If you only need the window module then you could try. I don't remember exactly if there were deprecated functions involved in this module or not. The modification on the SFML side should be painless : just add the following code into sf::priv::SFContext::createContext (src/SFML/Window/OSX/SFContext.mm:150 (https://github.com/SFML/SFML/blob/master/src/SFML/Window/OSX/SFContext.mm#L150))

    // Add support for OpenGL 3.2 on Mac OS X Lion and later
    if (settings.MajorVersion > 3 || (settings.MajorVersion == 3 && settings.MinorVersion >= 2)) {
        attrs.push_back(NSOpenGLPFAOpenGLProfile);
        attrs.push_back(NSOpenGLProfileVersion3_2Core);
    } else {
        attrs.push_back(NSOpenGLPFAOpenGLProfile);
        attrs.push_back(NSOpenGLProfileVersionLegacy);
    }

I think that should do it. Let me know if you succeed or not.
Title: Re: Any workaround for Lion OpenGL 3.2 Support?
Post by: eXpl0it3r on September 06, 2012, 10:46:06 am
1/ Removing deprecated stuff is targeted for SFML 1.x, i.e. it's not the highest priority-task.
You mean 2.x, right? ;)
Title: Re: Any workaround for Lion OpenGL 3.2 Support?
Post by: Hiura on September 06, 2012, 10:49:50 am
yep ;D
Title: Re: Any workaround for Lion OpenGL 3.2 Support?
Post by: chrono_fatalis on October 16, 2012, 04:44:58 am
Sorry I am pretty new to all this.  I apologize in advance for my ignorance.  I've been spending a lot of time trying to figure this out.  Do I need to download that GitHub file and add that code snippet in put it somewhere with in the framework folder?  Or is that file already on my computer in the source files?  If so I used the installer to install the framework.  Where does the installer put the source files?
Title: Re: Any workaround for Lion OpenGL 3.2 Support?
Post by: Hiura on October 16, 2012, 11:02:52 am
The installer won't help you there. You have to get a fresh and up-to-date copy of SFML (i.e. clone the git repo) and apply the above modification.

Now, keep in mind that this snippet was not tested; if you don't really need opengl 3.2 then don't lose too much time with this. ;-)
Title: Re: Any workaround for Lion OpenGL 3.2 Support?
Post by: chrono_fatalis on October 23, 2012, 04:44:57 am
Sorry it took me so long to reply back I've been very busy with school and work.  I unfortunately wasn't able to get this working.  I haven't given up on this yet and I have some questions.  I'm just gonna give you a run down of what I did.

1.) I downloaded the files on GitHub and downloaded CMake.
2.) In CMake I used Unix Makefiles generator.
3.) Once those files were generated I ran the make file that is in the top most folder of the generated file hierarchy. 

Also at this point I ran into and error with the code snippet you provided.  All that needed to be done to fix this was change the "M" in MajorVersion and MinorVersion to a lowercase "m".

4.) After I ran that make file I copied the SFML.framework folder that was generated and moved it into my /Library/Framework folder and relinked the framework with my project. 

I don't know if you see somewhere I went wrong there but I have a questions as well.

Do I need to run all the make files that are generated or are they automatically run when that topmost one is run?

Thanks for all the help!
Title: Re: Any workaround for Lion OpenGL 3.2 Support?
Post by: Hiura on October 23, 2012, 12:18:00 pm
Quote
I've been very busy with school and work.
Same here, don't worry about speed  ;)

You can try the following :

- did you compile frameworks or dylibs ? You might want to choose frameworks instead of the default value, i.e. dylib. (see cmake tutorial)
- instead of copying by hand the produced file use make install. Note that there are 6 produced frameworks (system, window, graphics, audio, network and the special one for header : SFML.framework).

Quote
Do I need to run all the make files that are generated or are they automatically run when that topmost one is run?
You don't need to dive into subfolders. The main makefile will call the others for you.
Title: Re: Any workaround for Lion OpenGL 3.2 Support?
Post by: chrono_fatalis on October 23, 2012, 07:36:29 pm
- did you compile frameworks or dylibs ? You might want to choose frameworks instead of the default value, i.e. dylib. (see cmake tutorial)
If by compile the frameworks you mean check the box in CMake that says SFML_BUILD_FRAMEWORKS then, yes I did.  Otherwise I'm not really sure what you mean by choose to compile the frameworks. 

I deleted the SFML frameworks from my /Library/Frameworks and ran the make install command to make sure I had all the up to date frameworks installed.  Then relinked my project with them.  Unfortunately it still didn't work. 

Is there anywhere else where you think I might have gone wrong?

Once again thank you guys for all the help!
Title: Re: Any workaround for Lion OpenGL 3.2 Support?
Post by: Hiura on October 24, 2012, 12:22:40 am
Can you give the exact error ?
Title: Re: Any workaround for Lion OpenGL 3.2 Support?
Post by: chrono_fatalis on October 24, 2012, 04:45:07 am
Well as stated above I am only trying to use SFML for window creation.  My program compiles fine however my shaders won't compile.  The shader error log contains the following:

ERROR: 0:1: '' :  version '150' is not supported

From my understanding GLSL version 1.50 is supported in OpenGL 3.2.

At this point am I safe in assuming that the code snippet provided isn't enough to add support for OpenGL 3.2?
Title: Re: Any workaround for Lion OpenGL 3.2 Support?
Post by: Hiura on October 24, 2012, 02:31:57 pm
According to https://developer.apple.com/graphicsimaging/opengl/capabilities/GLInfo_1075_Core.html GLSL 1.5 is supported. So it's seems the core profile was not activated.

Can you print the version of ogl your app is using ? You can use sf::Window::getSettings() to get it.
Title: Re: Any workaround for Lion OpenGL 3.2 Support?
Post by: chrono_fatalis on October 24, 2012, 05:10:33 pm
It says 2.1...

Is the version of OpenGL to be used not specified on window creation?  I was under the impression that this snippet of code was supposed make it so that a 3.2 context was being created on window creation if 3.2 support was available on the os/graphics card...

I am starting to get the feeling that this isn't the case. 
Title: Re: Any workaround for Lion OpenGL 3.2 Support?
Post by: Hiura on October 24, 2012, 05:56:52 pm
Sorry, didn't realize you didn't use sf::ContextSettings for the window creation... See http://www.sfml-dev.org/documentation/2.0/classsf_1_1Window.php#a33341e43c1282a698a39c587f14a2b72 .

By default SFML tries to use 2.0; see the default ctor of sf::ContextSettings here http://www.sfml-dev.org/documentation/2.0/structsf_1_1ContextSettings.php#aafe35f8e257f9d1e496ed64e33e2ee9f . But because 2.0 is not supported by OS X, SFML switch to 2.1.
Title: Re: Any workaround for Lion OpenGL 3.2 Support?
Post by: chrono_fatalis on October 27, 2012, 12:01:42 am
So it still fails to make the 3.2 context even when I specify after further research it turns out my graphics card doesn't support 3.2 only 3.1...

That being said I am sorry to have wasted your time on this.  Thank you for all your help.
Title: Re: Any workaround for Lion OpenGL 3.2 Support?
Post by: Hiura on October 27, 2012, 08:58:55 am
No prob.

But it's odd. Regarding Apple's OGL capabilities (https://developer.apple.com/graphicsimaging/opengl/capabilities/GLInfo_1075_Core.html) the supported context are 2.1 or 3.2. There's nothing in-between.

What is your Mac configuration ?
Title: Re: Any workaround for Lion OpenGL 3.2 Support?
Post by: golgoth on December 20, 2012, 05:50:17 am
Hello there,

As I'm also seeking a 3.2 context on Mac OS X, I tried the workaround mentioned by Hiura:
Quote
just add the following code into sf::priv::SFContext::createContext (src/SFML/Window/OSX/SFContext.mm:150)
and rebuild the Window library... but I still get a 2.1 context, is there anyone who made this work successfully?
Title: Re: Any workaround for Lion OpenGL 3.2 Support?
Post by: Hiura on December 20, 2012, 05:17:06 pm
Are you sure that the context settings of your sf::Window or sf::Context are set to use 3.2 ?
Title: Re: Any workaround for Lion OpenGL 3.2 Support?
Post by: golgoth on December 21, 2012, 04:34:41 pm
Yes, I'm very sure! I'm using a Hackintosh with a Geforce GTX 690 so we might have a problem there but GLview says it's 3.2 capable.
Title: Re: Any workaround for Lion OpenGL 3.2 Support?
Post by: Hiura on December 25, 2012, 08:00:16 pm
Quote
I'm using a Hackintosh with a Geforce GTX 690 so we might have a problem there
Most probably. Sorry, I can't you much.
Title: Re: Any workaround for Lion OpenGL 3.2 Support?
Post by: golgoth on January 07, 2013, 04:58:00 am
Any idea how I could track the 3.2 context issue, as when it will be implemented officially?
Title: Re: Any workaround for Lion OpenGL 3.2 Support?
Post by: Hiura on January 07, 2013, 10:04:49 am
All useful information related to this is on github here : https://github.com/SFML/SFML/issues/84

Additionally, this software might be helpful : http://www.realtech-vr.com/glview/
Title: Re: Any workaround for Lion OpenGL 3.2 Support?
Post by: golgoth on January 07, 2013, 06:30:17 pm
Would have been faster to fix the issue on the spot than writing the ticket... go mantognini go!
Title: Re: Any workaround for Lion OpenGL 3.2 Support?
Post by: Hiura on January 07, 2013, 07:41:31 pm
Please avoid post like this one in the future! We try to create a nice community here... Your sarcasm only hurts and is in no way helpful for making SFML better.

Also, you are wrong... read the issue's description once more.
Title: Re: Any workaround for Lion OpenGL 3.2 Support?
Post by: golgoth on January 07, 2013, 08:14:58 pm
Hiura, you are right, I see how it could be interpreted. My apologies if I hurt anyone.

That said, I didn't see that limitation coming and it sets me back a great deal. I hope it will be addressed sooner then later.  I'd be willing to test any work made in that direction if that could help.