Sign in to follow this  
biggoron

Extremely weird problem with GL shader compiler

Recommended Posts

biggoron    154
Whatever I do to my shaders under any circumstance, the shader info logs will say everything compiled fine, and the program log will say the shaders failed to link. Loading the shaders
	char* fSource = textFileRead("frag.txt");
	char* vSource = textFileRead("vert.txt");
	
	GLuint vShader, fShader;
	program = glCreateProgram();
	vShader = glCreateShader(GL_VERTEX_SHADER);
	fShader = glCreateShader(GL_FRAGMENT_SHADER);
	
	glShaderSource(vShader, 0, (const GLchar**)vSource, 0);
	glShaderSource(fShader, 0, (const GLchar**)fSource, 0);
	
	glCompileShader(vShader);
	glCompileShader(fShader);
	
	glAttachShader(program, vShader);
	glAttachShader(program, fShader);
	
	glLinkProgram(program);
	
	glUseProgram(program);
	glUniform1i(glGetUniformLocation(program, "shadowMap"), 0);
	
	char log[512];
	glGetShaderInfoLog(vShader, 512, 0, log);
	printf("%s\n", log);
	glGetShaderInfoLog(fShader, 512, 0, log);
	printf("%s\n", log);
	glGetProgramInfoLog(program, 512, 0, log);
	printf("%s\n", log);
	
	printf("%s\n", vSource);
	printf("%s\n", fSource);
	glUseProgram(0);
	
	delete[] vSource;
	delete[] fSource;
Shaders:
varying vec4 shadowCoord;

void main(void)
{
	gl_Position = ftransform();
	shadowCoord = gl_Vertex * gl_TextureMatrix[0] * gl_ModelViewMatrix;
}
varying vec4 shadowCoord;

uniform sampler2DShadow shadowMap;

void main(void)
{
	gl_FragColor = shadow2DProj(shadowMap, shadowCoord);
}
This is about the most annoying and obscure problem I've had so far. All help appreciated.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this