After debugging I was able to find glTexImage2D to be the cause of the crash
public class Textures {
public static int textureId;
public void prepare() {
try {
PNGDecoder textureDecoder = new PNGDecoder(Window.class.getResourceAsStream("/textures/sum.png"));
ByteBuffer textureBuffer = ByteBuffer.allocate(4* textureDecoder.getWidth() * textureDecoder.getHeight());
textureDecoder.decode(textureBuffer, textureDecoder.getWidth() * 4, Format.RGB);
textureBuffer.flip();
textureId = glGenTextures();
glBindTexture(GL_TEXTURE_2D, textureId);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, textureDecoder.getWidth(), textureDecoder.getHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE,
textureBuffer); // Program crashes here
System.out.println("E");
glGenerateMipmap(GL_TEXTURE_2D);
}
catch (IOException e) {
e.printStackTrace();
}
}
}
I found this answer but as you can see I already have that line but im still unable to fix the issue the program still crashes. Ive tried this aswell but still doesnt solve the issue