1

I'm using GLES 3.0 on my iOS app , trying to precompile GLSL shader program, but when I try to get length of the program binary like this:

    GLint len;
    glGetProgramiv(programId, GL_PROGRAM_BINARY_LENGTH, &len);

len becomes 0。 this is my code

    GLint len;
    glGetProgramiv(programId, GL_PROGRAM_BINARY_LENGTH, &len);
    int binaryFormat;
    glGetIntegerv(GL_PROGRAM_BINARY_FORMATS, &binaryFormat);
    char *binary = malloc(len);
    glGetProgramBinary(programId, len, &len, &binaryFormat, binary);

I try to set len=1024, then I got a glerror after glGetProgramBinary. Any one have any idea about this ?

BDL
  • 21,052
  • 22
  • 49
  • 55
Misery
  • 41
  • 4
  • 1
    Are you sure the program is linked successfully? The spec states: "When a program object’s LINK_STATUS is FALSE, its program binary length is zero, and a call to GetProgramBinary will generate an INVALID_OPERATION error" – BDL Oct 08 '18 at 09:00
  • I'm sure my program is linked successfully, I've use the program to draw my scene before. – Misery Oct 08 '18 at 11:27

0 Answers0