lwjglgamedev/lwjglbook-leg

Chapter 04: Shaders won't compile + no error log

Tomatosoupcodes opened this issue · 3 comments

Hi,
I tried running Chapter 4 and every time it runs I get a shader compilation error, even though the glGetProgramInfoLog displays nothing. I've checked and both the vertex and fragment shaders have this issue. I've also checked and the error log does work, as it shows errors when there are mistakes. I'm not sure why this happens, as my shaders as well as my createShader method are identical to the book's. Any help is appreciated (I'm using Eclipse BTW).
Here's the error:
java.lang.Exception: Error compiling shaders:
at main.java.com.Tomatosoupcodes.engine.ShaderProgram.createShader(ShaderProgram.java:38)
at main.java.com.Tomatosoupcodes.engine.ShaderProgram.createFragmentShader(ShaderProgram.java:25)

Hi,

It is still not clear to me if the source code for chapter 4 works for you as it is or not. In any case, a few things to check:

  • Make sure that the shader source code is not null.
  • Try to increase the size of the length in the call of the glGetShaderInfoLog method.

What OS and java version are you using?

Regards.

I am using Windows 10 Pro with Java 8. However, I think I've fixed it. I tried copying and pasting the createShader method from the book and it ran with no issue. However, I compared the code and mine was exactly the same except for the wording of the error messages and some slight differences in naming variables. I still have no idea why it wouldn't work.

Thank you for your time.

I'm glad to hear that you fixed this. I will close this issue then.