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

c2_triangle_elements.txt don't compile #31

Open
gheaeckkseqrz opened this issue Sep 29, 2014 · 5 comments
Open

c2_triangle_elements.txt don't compile #31

gheaeckkseqrz opened this issue Sep 29, 2014 · 5 comments

Comments

@gheaeckkseqrz
Copy link

On line 33, you pass settings as 4th argument of window, this variable doesn't exist.
I'm pretty sure the variable to use is context, I changed it, the code compile without errors, but it still displays nothing on my Macbook Air.

@Overv
Copy link
Owner

Overv commented Sep 29, 2014

Hi,

The typo has been corrected. I've just built the code on Windows and it appears to run without issues:

Are you running Mavericks?

@gheaeckkseqrz
Copy link
Author

Yes, I'm running Mavericks (10.9.5), with an Intel HD Graphics 5000 1536 MB graphics.
I just added a few checks, it seems that compiling the shaders fails.

    // Create and compile the vertex shader
    GLuint vertexShader = glCreateShader(GL_VERTEX_SHADER);
    glShaderSource(vertexShader, 1, &vertexSource, NULL);
    glCompileShader(vertexShader);

    GLint compileResult = GL_TRUE;
    glGetShaderiv(vertexShader, GL_COMPILE_STATUS, &compileResult);
    if (compileResult != GL_TRUE)
      {
        std::cerr << "Failled to compile vertexShader" << std::endl;
        return -1;
      }

I'll keep looking for the solution, I'll update this thread if I find something.

EDIT: Getting the compile error :

[23:47, ] rm -f a.out && make && ./a.out
g++ c2_triangle_elements.cpp -framework OpenGL -lGlew -lsfml-system -lsfml-window
Failled to compile vertexShader
ERROR: 0:1: '' :  version '150' is not supported
ERROR: 0:1: '' : syntax error #version

@Overv
Copy link
Owner

Overv commented Sep 30, 2014

Try adding:

settings.majorVersion = 3;
settings.minorVersion = 2;

Or context.* if you renamed them to that.

@gheaeckkseqrz
Copy link
Author

Tried this, it doesn't fix the problem.

From http://stackoverflow.com/questions/20931528/shader-cant-be-compiled

MacOS uses Legacy Profile as default for all created OpenGL context. Therefor by default only OpenGL up to 2.1 and GLSL up to 1.20 is supported.

To use OpenGL 3.2+ you need to switch to the Core Profile.

The page give example of how to do this with Glut, but I can't find anything equivalent in the (non-existing) glew documentation.

@Overv
Copy link
Owner

Overv commented Sep 30, 2014

In that case you should use SDL or GLFW to create the context. Both of these are modern libraries (unlike Glut) and have support for creating a core profile context, as described in the context chapter. I'll see if I can add a disclaimer for Mac users.

Edit: It appears that SFML should be creating a core profile context when passing 3 as major version:

https://github.com/LaurentGomila/SFML/blob/master/src/SFML/Window/OSX/SFContext.mm#L199

I'm not sure why it's not working. You could try filing a bug with SFML.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants