开发者

glUseProgramObjectARB invalid operation error

开发者 https://www.devze.com 2023-02-28 09:16 出处:网络
I\'m getting an \"invalid operation\" error when trying to use glUseProgramObjectARB and I have no idea why.

I'm getting an "invalid operation" error when trying to use glUseProgramObjectARB and I have no idea why.

The shader programs are loading correctly, I'm fairly sure. This is shown on glGetInfoLogARB:

  • Vertex shader was successfully compiled to run on hardware.
  • Fragment shader was successfully compiled to run on this hardware.

There are no previous openGL errors before this command. So something with this specific command definitely appears to be the issue.

I'm using glew with SDL. I was using GLee before, and getting the same problem.

Reading the documentation I assume it is this error:

GL_INVALID_OPERATION is generated if program could not be made part of current state.

but I'm not sure exactly what could cause such a thing. The command is issued in a working openGL context, as all the previous shade开发者_如何学编程r commands work fine. It is not between a "begin" and "end" block.

Really I am stumped as to what it could mean. Perhaps there is some more specific case when the command can't be issued. If anyone knows anything more that would be great.

EDIT:

Solved: oh jesus that was retarded, I was missing a return on one of my function calls elsewhere and so wasn't passing back the program I'd constructed.


Without seeing your code it's hard to know, but since you explicitly mention the results of glCompileShaderARB (times two) but not glLinkProgramARB I will guess that you forgot to glLinkProgramARB (after which, by the way, you can safely glDeleteObjectARB the two shader objects).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号