Reputation: 45
I'm tring to implement a Shader in a LWJGL Application. Got an 'invalid Enum' Exception if i try to attach the Shader. Okay, Code talke more....
private void attach(int progID) {
GL20.glAttachShader(progID, vertShaderID);
GL20.glAttachShader(progID, fragShaderID);
System.out.println("Tester: " + GLU.gluErrorString(GL11.glGetError()));
GL20.glLinkProgram(progID);
System.out.println("Tester: " + GLU.gluErrorString(GL11.glGetError()));
if(GL20.glGetShader(progID, GL20.GL_LINK_STATUS) == GL11.GL_FALSE) {
System.err.println("error during linking shaders! " + GL20.glGetProgramInfoLog(progID, 1000) + " " + GLU.gluErrorString(GL11.glGetError()));
}
GL20.glValidateProgram(progID);
System.out.println(GL20.glGetProgramInfoLog(progID, 1000));
System.out.println("Tester: " + GLU.gluErrorString(GL11.glGetError()));
System.out.println(GL20.glGetProgramInfoLog(progID, 1000));
if(GL20.glGetShader(progID, GL20.GL_VALIDATE_STATUS) == GL11.GL_FALSE) {
System.err.println("error during validating shaders! " + GL20.glGetProgramInfoLog(progID, 1000) + " " + GLU.gluErrorString(GL11.glGetError()));
}
}
produces output:
Tester: No error
Tester: No error
Validation successfull
Tester: Invalid Enum
Validation successfull
So i follow the source of Exception to this Function. What does this Validation Function? If the program Log is 'Validation successfull', what produces this Error? Or is that Error called from any other Situation where I used a GL Function in the Application? And what means The Invlaid Enum Error? It means that i used a GL Type wrong?
Upvotes: 1
Views: 636
Reputation: 43359
GL_LINK_STATUS
is not something you can query with glGetShader{iv} (...)
, that is for shader status. You probably meant to use GL_COMPILE_STATUS
for each of your shaders.
GL20.glGetShader (vertShaderID, GL20.GL_COMPILE_STATUS);
GL20.glGetShader (fragShaderID, GL20.GL_COMPILE_STATUS);
GL_LINK_STATUS
is only a valid enum for glGetProgram{iv} (...)
:
GL20.glGetProgram (progID, GL20.GL_LINK_STATUS);
Ideally you should check the compile status for each shader, and then the link status after linking all shaders using the functions and enums I mentioned above.
Upvotes: 2