package ocgtk
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=4e50fdb5093136a10fc8ffbe388e44cbcb70d52f8afdd48863ec7e22580ff054
doc/ocgtk.gsk/Ocgtk_gsk/Gsk/Wrappers/Gl_shader/index.html
Module Wrappers.Gl_shader
type t = [ `gl_shader | `object_ ] Gobject.objval new_from_bytes : Glib_bytes.t -> tCreate a new GLShader
val new_from_resource : string -> tCreate a new GLShader
val get_uniform_type : t -> int -> Gsk_enums.gluniformtypeGet the type of the declared uniform for this shader at index @idx.
val get_uniform_offset : t -> int -> intGet the offset into the data block where data for this uniforms is stored.
val get_uniform_name : t -> int -> stringGet the name of the declared uniform for this shader at index @idx.
val get_source : t -> Glib_bytes.tGets the GLSL sourcecode being used to render this shader.
val get_resource : t -> string optionGets the resource path for the GLSL sourcecode being used to render this shader.
val get_n_uniforms : t -> intGet the number of declared uniforms for this shader.
val get_n_textures : t -> intReturns the number of textures that the shader requires.
This can be used to check that the a passed shader works in your usecase. It is determined by looking at the highest u_textureN value that the shader defines.
Get the size of the data block used to specify arguments for this shader.
val get_arg_vec4 :
t ->
Glib_bytes.t ->
int ->
Ocgtk_graphene.Graphene.Wrappers.Vec4.t ->
unitGets the value of the uniform @idx in the @args block.
The uniform must be of vec4 type.
val get_arg_vec3 :
t ->
Glib_bytes.t ->
int ->
Ocgtk_graphene.Graphene.Wrappers.Vec3.t ->
unitGets the value of the uniform @idx in the @args block.
The uniform must be of vec3 type.
val get_arg_vec2 :
t ->
Glib_bytes.t ->
int ->
Ocgtk_graphene.Graphene.Wrappers.Vec2.t ->
unitGets the value of the uniform @idx in the @args block.
The uniform must be of vec2 type.
val get_arg_uint : t -> Glib_bytes.t -> int -> UInt32.tGets the value of the uniform @idx in the @args block.
The uniform must be of uint type.
val get_arg_int : t -> Glib_bytes.t -> int -> Int32.tGets the value of the uniform @idx in the @args block.
The uniform must be of int type.
val get_arg_float : t -> Glib_bytes.t -> int -> floatGets the value of the uniform @idx in the @args block.
The uniform must be of float type.
val get_arg_bool : t -> Glib_bytes.t -> int -> boolGets the value of the uniform @idx in the @args block.
The uniform must be of bool type.
val find_uniform_by_name : t -> string -> intLooks for a uniform by the name @name, and returns the index of the uniform, or -1 if it was not found.
val compile :
t ->
[ `renderer | `object_ ] Gobject.obj ->
(bool, GError.t) resultTries to compile the @shader for the given @renderer.
If there is a problem, this function returns %FALSE and reports an error. You should use this function before relying on the shader for rendering and use a fallback with a simpler shader or without shaders if it fails.
Note that this will modify the rendering state (for example change the current GL context) and requires the renderer to be set up. This means that the widget has to be realized. Commonly you want to call this from the realize signal of a widget, or during widget snapshot.