Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Any workaround for Lion OpenGL 3.2 Support?  (Read 11702 times)

0 Members and 1 Guest are viewing this topic.

PixelMuffin

  • Newbie
  • *
  • Posts: 18
    • View Profile
Any workaround for Lion OpenGL 3.2 Support?
« 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!

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Any workaround for Lion OpenGL 3.2 Support?
« Reply #1 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)

    // 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.
« Last Edit: September 06, 2012, 10:50:04 am by Hiura »
SFML / OS X developer

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10800
    • View Profile
    • development blog
    • Email
Re: Any workaround for Lion OpenGL 3.2 Support?
« Reply #2 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? ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Any workaround for Lion OpenGL 3.2 Support?
« Reply #3 on: September 06, 2012, 10:49:50 am »
yep ;D
SFML / OS X developer

chrono_fatalis

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Any workaround for Lion OpenGL 3.2 Support?
« Reply #4 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?

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Any workaround for Lion OpenGL 3.2 Support?
« Reply #5 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. ;-)
SFML / OS X developer

chrono_fatalis

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Any workaround for Lion OpenGL 3.2 Support?
« Reply #6 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!

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Any workaround for Lion OpenGL 3.2 Support?
« Reply #7 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.
SFML / OS X developer

chrono_fatalis

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Any workaround for Lion OpenGL 3.2 Support?
« Reply #8 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!

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Any workaround for Lion OpenGL 3.2 Support?
« Reply #9 on: October 24, 2012, 12:22:40 am »
Can you give the exact error ?
SFML / OS X developer

chrono_fatalis

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Any workaround for Lion OpenGL 3.2 Support?
« Reply #10 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?
« Last Edit: October 24, 2012, 06:16:13 am by chrono_fatalis »

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Any workaround for Lion OpenGL 3.2 Support?
« Reply #11 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.
SFML / OS X developer

chrono_fatalis

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Any workaround for Lion OpenGL 3.2 Support?
« Reply #12 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. 

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Any workaround for Lion OpenGL 3.2 Support?
« Reply #13 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.
SFML / OS X developer

chrono_fatalis

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Any workaround for Lion OpenGL 3.2 Support?
« Reply #14 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.

 

anything