Jump to content
  • Advertisement
Sign in to follow this  
Seikilos

OpenGL glUseProgram throw error 1281

This topic is 3354 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

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!