How do I fix "Link error: Linking ES Shaders with non-ES shaders is not supported."?

357 Views Asked by At

I'm currently learning OpenGL and C, and have run into a problem with shader linking.
I am using GLSL and Raylib and my goal is to generate the Mandelbrot set.
My computer is running MacOS 10.12.6 with an NVIDIA GeForce 320M 256 MB graphics card.
When I compile and run the program, all I get is the black rectangle texture (specified in the code) with no shader, and upon closing, this info:

...
INFO: SHADER: [ID 1] Compiled successfully
INFO: SHADER: [ID 2] Compiled successfully
INFO: SHADER: [ID 3] Program loaded successfully
INFO: SHADER: [ID 3] Default shader loaded successfully
INFO: RLGL: Internal vertex buffers initialized successfully in RAM (CPU)
INFO: RLGL: Render batch vertex buffers loaded successfully
INFO: RLGL: Default state initialized successfully
INFO: TEXTURE: [ID 2] Texture created successfully (128x128 - 1 mipmaps)
INFO: FONT: Default font loaded successfully
INFO: FILEIO: [shader.glsl] Text file loaded successfully
INFO: SHADER: [ID 4] Compiled successfully
WARNING: SHADER: [ID 5] Failed to link shader program
WARNING: SHADER: [ID 5] Link error: ERROR: Error: Linking ES shaders with non-ES shaders is not supported.

WARNING: SHADER: Failed to load custom shader code
...

Irrelevant of what the shader code contains, I always get this warning and the same black window, however when my friend compiles and runs the same code, no such error occurs. He is running Linux and compiling with GCC.

The error is about linking ES shaders and non-ES shaders, which is not what I think I have done. All I'm trying to do is link to a non-ES shader to my C program. (at least that's what I think I'm doing)

Looking online, I can't find anyone having a similar issue at all, and my lack of experience with shaders doesn't help either so I'm quite stuck at this point.

Any help would be greatly appreciated.

My C code:

#include <raylib.h>

const int width = 1280;
const int height = 1280;

int main() {
    InitWindow(width, height, "brotshader");

    Shader shader = LoadShader(0, "shader.glsl");
    RenderTexture2D target = LoadRenderTexture(width, height);

    SetTargetFPS(60);

    while (!WindowShouldClose()) {
        BeginDrawing();

        ClearBackground(RAYWHITE);

        BeginTextureMode(target);
        DrawRectangle(0, 0, width, height, BLACK);
        EndTextureMode();

        BeginShaderMode(shader);
        DrawTexture(target.texture, 0, 0, WHITE);
        EndShaderMode();

        EndDrawing();
    }
    UnloadShader(shader);
    UnloadRenderTexture(target);

    CloseWindow();
}

And the contents of my GLSL shader file (minimum reproducible example):

#version 100

void main() {
}
0

There are 0 best solutions below