Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS OpenGL ES version string incorrect formatting #1249

Closed
kingnobody8 opened this issue Jul 9, 2017 · 7 comments
Closed

iOS OpenGL ES version string incorrect formatting #1249

kingnobody8 opened this issue Jul 9, 2017 · 7 comments

Comments

@kingnobody8
Copy link

SFML calls glGetVersionString in GLContext.cpp. It assumes the first 3 characters of the string are major.minor. example (on windows PC): "4.5.0 NVIDEA 382.53"

However, on iOS devices this format is not consistent. Here are examples below:
dev iPad Air: "OpenGL ES-CM 1.1 Apple A7 GPU - 95.58"
dev iPhone SE: "OpenGL ES-CM 1.1 Metal - 33"
sim iPhone 5: "OpenGL ES-CM 1.1 APPLE-14.0.15"
sim iPad Pro 9.7in: "OpenGL ES-CM 1.1 APPLE-14.0.15"

this causes some undefined behavior with rendering, because sfml doesn't use the correct opengl es version.

Please implement a fix to take into account iOS formatting.
I also recommend this be tested for android as well, unfortunately I am not set with android to confirm or deny if there is even a problem for that platform.

@mantognini
Copy link
Member

Please implement a fix to take into account iOS formatting.

We solely rely on the community for the iOS implementation. If you can, please follow our Contribution Guidelines to provide a patch (and report future bugs). Thanks.

@JonnyPtn
Copy link
Contributor

@kingnobody8 do you still have this issue? What are the symptoms and the reproduction steps?

@kingnobody8
Copy link
Author

Yes this issue still persists. To see this, just run anything on iOS, and put a breakpoint inside function void GlContext::initialize(const ContextSettings& requestedSettings). You will see that the 'version' is NOT null, but the format is different, so major and minor version are set to incorrect values. Currently sfml doesn't suppport OpenGL ES higher than 1.1, so this should just set the version to 1.1 only if iOS/Android is detected.
I have implemented a workaround locally. But i haven't put up a pull request for it yet. Here is the temporary fix: Starting at line 584 of GLContext.cpp is this block of "Try the old way". Replace that whole block with the following code.

` // Try the old way
 const GLubyte* version = glGetString(GL_VERSION);
	
#ifndef SFML_SYSTEM_IOS /*EDIT START*/
    if (version)
    {
        // The beginning of the returned string is "major.minor" (this is standard)
        m_settings.majorVersion = version[0] - '0';
        m_settings.minorVersion = version[2] - '0';
    }
    else
    {
        // Can't get the version number, assume 1.1
        m_settings.majorVersion = 1;
        m_settings.minorVersion = 1;
    }
#else
	m_settings.majorVersion = 1;
	m_settings.minorVersion = 1;
#endif /*EDIT FINISH*/`

@binary1248
Copy link
Member

Just out of curiosity... what does the exact version string look like on iOS?

@LaurentGomila
Copy link
Member

Just out of curiosity... what does the exact version string look like on iOS?

Examples are given in the first post:

dev iPad Air: "OpenGL ES-CM 1.1 Apple A7 GPU - 95.58"
dev iPhone SE: "OpenGL ES-CM 1.1 Metal - 33"
sim iPhone 5: "OpenGL ES-CM 1.1 APPLE-14.0.15"
sim iPad Pro 9.7in: "OpenGL ES-CM 1.1 APPLE-14.0.15"

@binary1248
Copy link
Member

@kingnobody8 Try out #1390.

@kingnobody8
Copy link
Author

kingnobody8 commented Mar 18, 2018

Looks good. Thank you very much. I'll close this issue once it's merged into main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
SFML 2.5.0
  
Merged / Superseded
Development

No branches or pull requests

6 participants