GLSL Linker error

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
n00bc0de
Posts: 39
Joined: Tue Oct 04, 2022 1:21 am

GLSL Linker error

Post by n00bc0de »

I tried using the driver from the most recent opengl es branch when SDL2. Irrlicht compiles just fine and I was able to compile and run the hello world example without any issues. However when it runs I get an error stating "GLSL shader program failed to link" and "error: fragment shader lacks 'main'". Has anyone else ran into this issue?

It seems to be related to SDL2 specifically but if I run a program and build a simple shader with SDL2 by itself it seems to work just fine.

Also, this issue is specifically related to the OGLES2 driver. I have used the OGLES2 driver with the X11 device without any issues so I am pretty convinced that maybe I am doing something wrong in setting up the context but like I said earlier, I am able to run any GLES2 example with just SDL2 just fine.
n00bc0de
Posts: 39
Joined: Tue Oct 04, 2022 1:21 am

Re: GLSL Linker error

Post by n00bc0de »

I found the issue. In the SDL2 device, I had these lines:

Code: Select all

SDL_GL_SetAttribute( SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE );
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
I replaced it with these lines for to get it to work with the OGLES2 driver:

Code: Select all

SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
I am shocked I didn't catch this sooner.
n00bc0de
Posts: 39
Joined: Tue Oct 04, 2022 1:21 am

Re: GLSL Linker error

Post by n00bc0de »

I want to make one more note on this incase someone else finds it helpful. I recently made some changes to my SDL2 device that broke OpenGLES support. I changed SDL_Init() from initializing video and events to initializing everything. This would normally work just fine but audio failed to initialize. This caused the entire SDL_Init() call to fail. If SDL_Init() fails for one thing, then it fails to initialize anything which caused SDL_GL_CreateContext() to fail in the driver. To prevent this from happening, I would recommend only giving SDL_Init() the SDL_INIT_VIDEO, SDL_INIT_TIMER, and SDL_INIT_NOPARACHUTE. Irrlicht doesn't need the other stuff so you can initializing them outside of irrlicht.
Post Reply