def print_error(message): nonlocal error error = True status = GLint() glGetProgramiv(program, GL_INFO_LOG_LENGTH, byref( status)) # Getting the number of char in info log to 'status' output = create_string_buffer(status.value) # status.value) glGetProgramInfoLog(program, status, None, output) print(message, output.value.decode('utf-8'), file=sys.stderr)
def program_status(program: GLuint, status_type: int) -> int: """ Args: program: The handle to the program. status_type: GL_DELETE_STATUS, GL_LINK_STATUS, GL_VALIDATE_STATUS, GL_INFO_LOG_LENGTH, GL_ATTACHED_SHADERS, GL_ACTIVE_ATOMIC_COUNTER_BUFFERS, GL_ACTIVE_ATTRIBUTES, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, GL_ACTIVE_UNIFORMS, GL_ACTIVE_UNIFORM_BLOCKS, GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH, GL_ACTIVE_UNIFORM_MAX_LENGTH, GL_COMPUTE_WORK_GROUP_SIZE GL_PROGRAM_BINARY_LENGTH, GL_TRANSFORM_FEEDBACK_BUFFER_MODE, GL_TRANSFORM_FEEDBACK_VARYINGS, GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH, GL_GEOMETRY_VERTICES_OUT, GL_GEOMETRY_INPUT_TYPE, GL_GEOMETRY_OUTPUT_TYPE. Returns: Status code. """ status = GLint() glGetProgramiv(program, status_type, byref(status)) return status.value
def shader_status(shader: GLuint, status_type: int) -> GLint: """ Returns the status of the 'shader' for any given 'status_type'. Errors: GL_INVALID_VALUE: if shader is not a value generated by OpenGL. GL_INVALID_OPERATION: if shader does not refer to a shader object. GL_INVALID_ENUM: if status_type is not an accepted value. Args: shader: The handle to the shader. status_type: GL_SHADER_TYPE, GL_DELETE_STATUS, GL_COMPILE_STATUS, GL_INFO_LOG_LENGTH, GL_SHADER_SOURCE_LENGTH. Returns: """ status = GLint() glGetShaderiv(shader, status_type, byref(status)) return status.value
def print_error(message): nonlocal error error = True status = GLint() glGetShaderiv(shader, GL_INFO_LOG_LENGTH, byref(status)) output = create_string_buffer(status.value) glGetShaderInfoLog(shader, status, None, output) shader_source = '\n'.join([ '{:<3} | '.format(row) + line for row, line in enumerate(shader.source.splitlines(), start=1) ]) print(message, output.value.decode('utf-8'), 'Shader source:', shader_source, file=sys.stderr, sep='\n')