glUseProgram throw error 1281

Started by
3 comments, last by seedy 14 years, 9 months ago
I developed some really simple fragment and vertex shader (just a color mapping) and integrated it into an application via glUseProgram. Testing this on my machine, which has an ATI HD 2600 XT works perfectly. But when I tried this on our machines with NVIDIA GFX cards ( 7900 as far as I know) the glUseProgram returns the 1281 error. Which is the 0501 hex error code and means GL_INVALID_VALUE. I checked the value of the program, same on both machines. the code is really simple, and the error description of open gl is less then helpful:
Quote:GL_INVALID_VALUE is generated if program is neither 0 nor a value generated by OpenGL.
The glCreateProgram() creates a program for me, so I have no idea, why it does not use it.

_vId = glCreateShader(GL_VERTEX_SHADER);  // value: 1
		
_fId = glCreateShader(GL_FRAGMENT_SHADER);  // value: 2
{
	const char*  arr = _vertexShader.c_str();
	glShaderSource(_vId,1, &arr,NULL);
	glCompileShader(_vId);
}
{
	const char*  arr = _fragmentShader.c_str();
	glShaderSource(_fId,1, &arr,NULL);
	glCompileShader(_fId);
}
	_program = glCreateProgram(); // value: 3
	glAttachShader(_program,_vId);
	glAttachShader(_program,_fId);
	glLinkProgram(_program);
        // no error returned from opengl here
        glUseProgram(_program); // still value: 3, created by opengl
My timezone is GMT+1 so excuse my 'late' postings :)
Advertisement
It looks like you aren't checking for errors

glCompileShader(_vId);
glGetShaderiv(_vId, GL_COMPILE_STATUS, &IsCompiled[0]);


glCompileShader(_fId);
glGetShaderiv(_fId, GL_COMPILE_STATUS, &IsCompiled[1]);

glLinkProgram(_program);
glGetProgramiv(_program, GL_LINK_STATUS, &IsLinked);

you can also read the info log in case you get an error.
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
Hello,
i will check that. where do you find the info log?

I doubt that there are any errors since same file and even same build version of everything is used on other pcs.
My timezone is GMT+1 so excuse my 'late' postings :)
http://www.lighthouse3d.com/opengl/glsl/index.php?oglinfo

read the part in Orange, that is GL 2.0 code.
void glGetShaderInfoLog(GLuint object, int maxLen, int *len, char *log);
and also
void glGetProgramInfoLog(GLuint object, int maxLen, int *len, char *log);
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
<deleted>

This topic is closed to new replies.

Advertisement