picogl.backend.modern.core.shader.compile

Utility function for compiling and attaching a shader to a shader program.

This function creates a shader of the specified type, sets its source, compiles it, and attaches it to the given shader program. If the compilation fails, an exception is raised with the compilation error message.

param shader_program:

Shader program ID to which the compiled shader will be attached.

type shader_program:

int

param shader_type:

Type of shader to compile (e.g., GL_VERTEX_SHADER, GL_FRAGMENT_SHADER).

type shader_type:

int

param source:

GLSL source code of the shader to compile.

type source:

str

return:

Shader ID of the compiled shader.

rtype:

int

raises Exception:

If the shader compilation fails, an exception is raised with the associated error log.

Functions

compile_shader(shader_program, shader_type, source) → int

compile_vertex_shader

Module Contents

picogl.backend.modern.core.shader.compile.compile_shader(shader_program: int, shader_type: GLShader, source: str) → int[source]

compile_vertex_shader

Parameters:
  • shader_program – int shader program

  • shader_type – int shader type e.g. GL_VERTEX_SHADER GL_FRAGMENT_SHADER

  • source – shader source string

:return int