struct Gloop::Program
- Gloop::Program
- Gloop::Object
- Struct
- Value
- Object
Overview
Represents one or more shaders.
See: https://www.khronos.org/opengl/wiki/GLSL_Object#Program_objects
Included Modules
- Gloop::Parameters
Defined in:
gloop/program.crgloop/program/binary.cr
gloop/program/link_error.cr
gloop/program/uniform_location.cr
gloop/program/uniforms.cr
Constructors
-
.create(context) : self
Creates a new program.
-
.from_binary(context, binary) : self
Creates a program from an existing binary.
Class Method Summary
-
.current(context)
Retrieves the current program in use.
-
.current?(context)
Retrieves the current program in use.
-
.uninstall(context) : Nil
Uninstalls any existing program from the context's rendering state.
Instance Method Summary
-
#attach(shader) : Nil
Attaches the specified shader to this program.
-
#binary : Binary
Retrieves the binary data representing the compiled and linked program.
-
#binary=(binary)
Load an existing program binary.
-
#binary_size
Retrieves the length, in bytes, of the program's binary.
-
#delete : Nil
Indicates to OpenGL that this program can be deleted.
-
#deleted? : Bool
Checks if the program has been deleted.
-
#detach(shader) : Nil
Detaches the specified shader from this program.
-
#exists?
Checks if this program is known to the graphics driver.
-
#info_log : String | Nil
Retrieves information about the program's link process and validation.
-
#info_log_size
Retrieves the size of the information log for this program.
-
#link : Bool
Attempts to link the shaders together to build the final program.
-
#link! : Nil
Attempts to link the shaders together to build the final program.
-
#linked? : Bool
Checks if the program has been linked successfully.
-
#object_type
Indicates that this is a program object.
-
#shader_count
Retrieves the number of shaders currently attached to the program.
-
#shaders : Indexable(Shader)
Retrieves the shaders attached to the program.
-
#uniforms : Uniforms
Provides access to the active uniforms in this program.
-
#use : Nil
Installs this program as part of the context's rendering state.
-
#use(&)
Installs this program as part of the context's rendering state.
-
#valid? : Bool
Checks the result of the last validation.
-
#validate : Bool
Checks if the program can be used in OpenGL's current state.
Instance methods inherited from struct Gloop::Object
context : Context
context,
name : Name
name,
none?
none?,
object_type
object_type,
to_s(io)
to_s,
to_unsafe : UInt32
to_unsafe
Constructor methods inherited from struct Gloop::Object
new(context : Context, name : Name)
new,
none(context) : self
none
Instance methods inherited from module Gloop::Labelable
label : String
label,
label=(label : Nil)label=(label) label=, max_label_size : Int32 max_label_size, name name, object_type object_type
Constructor Detail
Creates a new program.
- OpenGL function:
glCreateProgram
- OpenGL version: 2.0
Class Method Detail
Retrieves the current program in use.
Returns a null-object (.none
) if there isn't a program in use.
See: #use
- OpenGL function:
glGetIntegerv
- OpenGL enum:
GL_CURRENT_PROGRAM
- OpenGL version: 2.0
Retrieves the current program in use.
Returns nil if there isn't a program in use.
See: #use
- OpenGL function:
glGetIntegerv
- OpenGL enum:
GL_CURRENT_PROGRAM
- OpenGL version: 2.0
Uninstalls any existing program from the context's rendering state.
- OpenGL function:
glUseProgram
- OpenGL version: 2.0
Instance Method Detail
Attaches the specified shader to this program.
- OpenGL function:
glAttachShader
- OpenGL version: 2.0
Retrieves the binary data representing the compiled and linked program.
- OpenGL function:
glGetProgramBinary
- OpenGL version: 4.1
Load an existing program binary.
- OpenGL function:
glProgramBinary
- OpenGL version: 4.1
Retrieves the length, in bytes, of the program's binary.
If linking failed or the binary is unavailable, this will be zero.
See: #binary
- OpenGL function:
glGetProgramiv
- OpenGL enum:
GL_PROGRAM_BINARY_LENGTH
- OpenGL version: 4.1
Indicates to OpenGL that this program can be deleted.
When there are no more references to the program, its resources will be released.
See: #deleted?
- OpenGL function:
glDeleteProgram
- OpenGL version: 2.0
Checks if the program has been deleted.
Note: This property only returns true if the program is deleted, but still exists. If it doesn't exist (all resources freed), then this property can return false.
See: #delete
- OpenGL function:
glGetProgramiv
- OpenGL enum:
GL_DELETE_STATUS
- OpenGL version: 2.0
Detaches the specified shader from this program.
- OpenGL function:
glDetachShader
- OpenGL version: 2.0
Checks if this program is known to the graphics driver.
- OpenGL function:
glIsProgram
- OpenGL version: 2.0
Retrieves information about the program's link process and validation.
Nil will be returned if there's no log available.
The information log is OpenGL's mechanism for conveying information to application developers. Even if the linkage or validation was successful, some useful information may be in it.
- OpenGL function:
glGetProgramInfoLog
- OpenGL version: 2.0
Retrieves the size of the information log for this program.
If the log is unavailable, nil is returned.
See: #info_log
- OpenGL function:
glGetProgramiv
- OpenGL enum:
GL_INFO_LOG_LENGTH
- OpenGL version: 2.0
Attempts to link the shaders together to build the final program.
Returns true if the link process was successful, false otherwise.
See: #link!
- OpenGL function:
glLinkProgram
- OpenGL version: 2.0
Attempts to link the shaders together to build the final program.
Raises LinkError
if the process fails.
See: #link
- OpenGL function:
glLinkProgram
- OpenGL version: 2.0
Checks if the program has been linked successfully.
See: #link
- OpenGL function:
glGetProgramiv
- OpenGL enum: `GL_LINK_STATUS
- OpenGL version: 2.0
Retrieves the number of shaders currently attached to the program.
See: #shaders
- OpenGL function:
glGetProgramiv
- OpenGL enum:
GL_ATTACHED_SHADERS
- OpenGL version: 2.0
Retrieves the shaders attached to the program.
- OpenGL function:
glGetAttachedShaders
- OpenGL version: 2.0
Installs this program as part of the context's rendering state.
- OpenGL function:
glUseProgram
- OpenGL version: 2.0
Installs this program as part of the context's rendering state.
Restores the previous program after the block returns.
- OpenGL function:
glUseProgram
- OpenGL version: 2.0
Checks the result of the last validation.
See: #validate
- OpenGL function:
glGetProgramiv
- OpenGL enum:
GL_VALIDATE_STATUS
- OpenGL version: 2.0