• Advertisement
Sign in to follow this  

Extremely weird problem with GL shader compiler

This topic is 3624 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
Sign in to follow this  

  • Advertisement