Skip to content

stdlib/glView source ↗

gl

87 items · generated by scribe fromstdlib/gl.fd· synced 2026-11-15

stdlib/gl87 items

Contents

GL_DEPTH_TEST:

pub const GL_DEPTH_TEST: i64 = 0x0B71; pub const GL_CULL_FACE: i64 = 0x0B44; pub const GL_BLEND: i64 = 0x0BE2; pub const GL_TEXTURE_2D: i64 = 0x0DE1; pub const GL_TEXTURE0: i64 = 0x84C0;

Defined at line 82


GL_TRIANGLES:

pub const GL_TRIANGLES: i64 = 0x0004; pub const GL_TRIANGLE_STRIP: i64 = 0x0005; pub const GL_TRIANGLE_FAN: i64 = 0x0006; pub const GL_LINES: i64 = 0x0001; pub const GL_LINE_STRIP: i64 = 0x0003; pub const GL_POINTS: i64 = 0x0000;

Defined at line 83


GL_COLOR_BUFFER_BIT:

pub const GL_COLOR_BUFFER_BIT: i64 = 0x4000; pub const GL_DEPTH_BUFFER_BIT: i64 = 0x100;

Defined at line 84


GL_ARRAY_BUFFER:

pub const GL_ARRAY_BUFFER: i64 = 0x8892; pub const GL_ELEMENT_ARRAY_BUFFER: i64 = 0x8893;

Defined at line 85


GL_STATIC_DRAW:

pub const GL_STATIC_DRAW: i64 = 0x88E4; pub const GL_DYNAMIC_DRAW: i64 = 0x88E8; pub const GL_STREAM_DRAW: i64 = 0x88E0;

Defined at line 86


GL_FLOAT:

pub const GL_FLOAT: i64 = 0x1406; pub const GL_UNSIGNED_INT: i64 = 0x1405; pub const GL_UNSIGNED_BYTE: i64 = 0x1401;

Defined at line 87


GL_RGB:

pub const GL_RGB: i64 = 0x1907; pub const GL_RGBA: i64 = 0x1908; pub const GL_TEXTURE_MIN_FILTER: i64 = 0x2801; pub const GL_TEXTURE_MAG_FILTER: i64 = 0x2800; pub const GL_TEXTURE_WRAP_S: i64 = 0x2802; pub const GL_TEXTURE_WRAP_T: i64 = 0x2803; pub const GL_LINEAR: i64 = 0x2601; pub const GL_NEAREST: i64 = 0x2600; pub const GL_CLAMP_TO_EDGE: i64 = 0x812F; pub const GL_REPEAT: i64 = 0x2901;

Defined at line 88


GL_NO_ERROR:

pub const GL_NO_ERROR: i64 = 0; pub const GL_INVALID_ENUM: i64 = 0x0500; pub const GL_INVALID_VALUE: i64 = 0x0501; pub const GL_INVALID_OPERATION: i64 = 0x0502; pub const GL_OUT_OF_MEMORY: i64 = 0x0505;

Defined at line 89


GL_FRONT:

pub const GL_FRONT: i64 = 0x0404; pub const GL_BACK: i64 = 0x0405; pub const GL_CW: i64 = 0x0900; pub const GL_CCW: i64 = 0x0901;

Defined at line 90


GL_SRC_ALPHA:

pub const GL_SRC_ALPHA: i64 = 0x0302; pub const GL_ONE_MINUS_SRC_ALPHA: i64 = 0x0303;

Defined at line 91


gl_init

Initialize OpenGL state (enable depth testing, etc.)

pub fn gl_init() -> void {

Returns: void

Defined at line 95


gl_clear_screen

Clear the screen.

pub fn gl_clear_screen() -> void {

Returns: void

Defined at line 102


gl_set_viewport

Set the viewport.

pub fn gl_set_viewport(w: i64, h: i64) -> void {

Parameters:

  • w: i64
  • h: i64

Returns: void

Defined at line 107


gl_check_errors

Check for OpenGL errors. Returns 0 if no error.

pub fn gl_check_errors() -> i64 {

Returns: i64

Defined at line 112


gl_gen_buffer

Generate a single buffer object.

pub fn gl_gen_buffer() -> i64 {

Returns: i64

Defined at line 117


gl_gen_vertex_array

Generate a single vertex array object.

pub fn gl_gen_vertex_array() -> i64 {

Returns: i64

Defined at line 126


gl_gen_texture

Generate a single texture.

pub fn gl_gen_texture() -> i64 {

Returns: i64

Defined at line 135


gl_delete_buffer

Delete a single buffer.

pub fn gl_delete_buffer(buf: i64) -> void {

Parameters:

  • buf: i64

Returns: void

Defined at line 144


gl_delete_vertex_array

Delete a single vertex array.

pub fn gl_delete_vertex_array(arr: i64) -> void {

Parameters:

  • arr: i64

Returns: void

Defined at line 151


gl_delete_texture

Delete a single texture.

pub fn gl_delete_texture(tex: i64) -> void {

Parameters:

  • tex: i64

Returns: void

Defined at line 158


gl_draw_triangles

Draw triangles from currently bound VBO data.

pub fn gl_draw_triangles(first: i64, count: i64) -> void {

Parameters:

  • first: i64
  • count: i64

Returns: void

Defined at line 165


gl_draw_triangles_indexed

Draw triangles from index buffer.

pub fn gl_draw_triangles_indexed(count: i64) -> void {

Parameters:

  • count: i64

Returns: void

Defined at line 170


gl_set_texture_defaults

Set default texture parameters for 2D textures.

pub fn gl_set_texture_defaults() -> void {

Returns: void

Defined at line 175


gl_enable_blend

Enable alpha blending for transparency.

pub fn gl_enable_blend() -> void {

Returns: void

Defined at line 183


gl_error_string

Get error string from error code.

pub fn gl_error_string(err: i64) -> str {

Parameters:

  • err: i64

Returns: str

Defined at line 189


GL_VERTEX_SHADER:

pub const GL_VERTEX_SHADER: i64 = 0x8B31; pub const GL_FRAGMENT_SHADER: i64 = 0x8B30;

Defined at line 243


GL_COMPILE_STATUS:

pub const GL_COMPILE_STATUS: i64 = 0x8B81; pub const GL_LINK_STATUS: i64 = 0x8B82;

Defined at line 245


gl_compile_shader_src

Compile a shader from source code. Returns shader ID or 0 on failure.

pub fn gl_compile_shader_src(shader_type: i64, source: str) -> i64 {

Parameters:

  • shader_type: i64
  • source: str

Returns: i64

Defined at line 247


gl_create_program_from_src

Create a shader program from vertex and fragment source. Returns program ID or 0 on failure.

pub fn gl_create_program_from_src(vert_src: str, frag_src: str) -> i64 {

Parameters:

  • vert_src: str
  • frag_src: str

Returns: i64

Defined at line 277


gl_set_uniform_mat4

Set a uniform mat4 value.

pub fn gl_set_uniform_mat4(location: i64, mat: i64) -> void {

Parameters:

  • location: i64
  • mat: i64

Returns: void

Defined at line 322


gl_set_uniform_f

Set a uniform float value.

pub fn gl_set_uniform_f(location: i64, value: f64) -> void {

Parameters:

  • location: i64
  • value: f64

Returns: void

Defined at line 327


gl_set_uniform_i

Set a uniform int value.

pub fn gl_set_uniform_i(location: i64, value: i64) -> void {

Parameters:

  • location: i64
  • value: i64

Returns: void

Defined at line 332


gl_get_uniform

Get the location of a uniform variable.

pub fn gl_get_uniform(program: i64, name: str) -> i64 {

Parameters:

  • program: i64
  • name: str

Returns: i64

Defined at line 337


gl_get_attrib

Get the location of an attribute variable.

pub fn gl_get_attrib(program: i64, name: str) -> i64 {

Parameters:

  • program: i64
  • name: str

Returns: i64

Defined at line 342


DEFAULT_VERT_SHADER:

Basic vertex shader for 3D rendering with MVP matrix.

pub const DEFAULT_VERT_SHADER: str = "#version 330 core\nlayout(location = 0) in vec3 aPos;\nlayout(location = 1) in vec3 aNormal;\nlayout(location = 2) in vec2 aTexCoord;\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\nout vec2 TexCoord;\nout vec3 Normal;\nvoid main() {\n    gl_Position = projection * view * model * vec4(aPos, 1.0);\n    TexCoord = aTexCoord;\n    Normal = mat3(transpose(inverse(model))) * aNormal;\n}\n";

Defined at line 349


DEFAULT_FRAG_SHADER:

Basic fragment shader with texture sampling.

pub const DEFAULT_FRAG_SHADER: str = "#version 330 core\nin vec2 TexCoord;\nin vec3 Normal;\nout vec4 FragColor;\nuniform sampler2D texture1;\nvoid main() {\n    FragColor = texture(texture1, TexCoord);\n}\n";

Defined at line 351


gl_create_default_program

Create the default shader program.

pub fn gl_create_default_program() -> i64 {

Returns: i64

Defined at line 353


Generated by scribe, the Fides documentation generator