HackerPoet / MarbleMarcher

A Fractal Physics Game
GNU General Public License v2.0
2.47k stars 167 forks source link

Add support for certain Intel GPUs #37

Closed CrushedPixel closed 5 years ago

CrushedPixel commented 5 years ago

Some GPUs, for example the Intel GPUs built into most MacBook models, don't support specifying floating-point values with integers in GLSL shaders. Therefore, the constant 1 in the context of a vec2 must be changed to 1.0 to make the vertex shader compile on these GPUs.

I had this issue on my Late 2013 MacBook Pro with the Built-in Intel Iris GPU. This small modification fixed the issue of the vertex shader not compiling on my system.

This should resolve issue #20.

HackerPoet commented 5 years ago

Thanks! I didn't know this was an issue.

CrushedPixel commented 5 years ago

Yeah, this is definitely an obscure one. Perhaps printing out the shader compilation error information would be helpful?

Something along the lines of

int success;
char info[512];
glGetShaderiv(vertexShaderHandle, GL_COMPILE_STATUS, &success);

if (!success) {
    glGetShaderInfoLog(vertexShaderHandle, 512, nullptr, info);
    std::cout << "vertex shader compilation failed\n" << info << "\n";
}