Change in fragmentshader crashes vertexshader

Hello guys,

While making a very simple 2d engine using openGL, glew, and glut, I used a fragmentshader that created a julia set fractal to test my shader loading code. However, while deleting the code that generates the fractal, I found a very interesting, and to me inexplicable bug. Deleting/changing certain values in the fragment shader somehow corrupts the vertexshader. I have created a github repository, where you can browse and try out the code. I’ll also add both shaders to the end of this post. The fragment and vertex-shader are in the game-directory. This also is the working directory.
github repo:
I stripped the code of anything that didn’t make it crash, so changing pretty much anything in the fragmentshader will make the vertexshader crash. Deleting either of the uniform floats at the beginning, or even replacing gl_FragCoord.x or gl_FragCoord.y with a random float value all does the trick. Any hints that could lead to solving this problem would be greatly appreciated.


#version 330 core

attribute vec2 coord2d;
uniform float zoom = 0.5;

void main(void) {
	gl_Position = vec4(coord2d * zoom, 0.0, 1.0);


#version 330 core

uniform float X = 1.0;
uniform float Y = 0.0;

vec3 OutputColor;

vec2 multiply(vec2 fac1, vec2 fac2) {
	return vec2(0.0, 0.0);

vec3 fractal (vec2 location, int iterations){
	vec2 escape = location;
	return vec3(0.0, 0.0, 0.0);

void main(void) {
	OutputColor = fractal (vec2(gl_FragCoord.x, gl_FragCoord.y), 100);
	gl_FragColor = vec4(0.5, 0.5, 0.5 ,0.0);

Best Regards,
Jan Heemstra

Just found out deleting the uniform float in the vertex shader does enable me to delete the stuff in the fragmentshader without crashing the vertex shader. However, I need the uniform value for my engine, and I can’t make a new one.

Another edit:
It seems my file-loading script is malicious, and somehow doesn’t load the shader correctly when I delete certain parts. I have yet to find out why it behaves that way. This is probably not an OpenGL problem, so you can probably disregard this post.

Another edit:
Apparently returning a c-string or converting my function directly into a c-string made my code very buggy. I fixed that by making a string variable that’s “inbetween”.