picogl.backend.gl.wrappers

Thin OpenGL call wrappers (legacy client state, pointers, buffers, draws).

Submodules

Functions

gl_bind_buffer(target, ebo_id)

gl bind buffer

gl_buffer_data([target, size, data, usage_hint])

gl bind buffer

gl_disable_legacy_client_state(state)

gl disable client state

gl_enable_legacy_client_state(state)

gl legacy client state

gl_draw_arrays(→ None)

Issue glDrawArrays with PicoGL draw-mode enums or raw gl constants.

gl_draw_elements(→ None)

Issue glDrawElements.

gl_enable_vertex_array(→ Any)

gl_enable_vertex_array

gl_generate_buffers(→ Any)

gl_generate_buffers

gl_generate_vertex_array(→ Any)

gl_generate_vertex_array

gl_color_array_pointer(pointer[, size, num_type, stride])

gl color pointer for mesh binding.

gl_color_pointer_from_spec(attr)

gl color pointer

gl_normal_array_pointer(pointer[, stride, num_type])

gl normal pointer for mesh binding.

gl_normal_pointer_from_spec(attr)

gl normal pointer

gl_texcoord_array_pointer(pointer[, size, stride, ...])

gl texcoord pointer for mesh binding.

gl_vertex_array_pointer(pointer[, size, num_type, stride])

gl vertex pointer for mesh binding.

gl_vertex_pointer_from_spec(attr)

gl legacy client state

gl_active_texture(→ None)

Issue glActiveTexture.

gl_bind_texture(→ None)

Issue glBindTexture.

gl_compressed_tex_image(→ None)

Issue glCompressedTexImage2D for a 2D texture.

gl_gen_textures(→ Any)

Issue glGenTextures.

gl_generate_mipmap(→ None)

Generate mipmaps for the currently bound texture.

gl_get_active_texture0(→ None)

Select texture unit 0.

gl_tex_parameter(→ None)

Issue glTexParameteri.

gl_teximage2d(→ None)

Issue glTexImage2D.

gl_teximage3d(→ None)

Issue glTexImage3D.

gl_bind_vertex_array(vao)

gl_bind_vertex_array

gl_vertex_attrib_pointer(→ None)

Issue glVertexAttribPointer.

gl_get_integerv(→ Any)

get integer value

Package Contents

picogl.backend.gl.wrappers.gl_bind_buffer(target, ebo_id: int | None)[source]

gl bind buffer

picogl.backend.gl.wrappers.gl_buffer_data(target: picogl.backend.gl.enums.GLBufferTarget = GLBufferTarget.ARRAY, size: int = 0, data=None, usage_hint: picogl.backend.gl.enums.GLUsageHint = GLUsageHint.STATIC_DRAW)[source]

gl bind buffer

picogl.backend.gl.wrappers.gl_disable_legacy_client_state(state: picogl.backend.gl.state.client.GLClientState)[source]

gl disable client state

picogl.backend.gl.wrappers.gl_enable_legacy_client_state(state: picogl.backend.gl.state.client.GLClientState)[source]

gl legacy client state

picogl.backend.gl.wrappers.gl_draw_arrays(index_count: int, mode: picogl.backend.gl.enums.GLDrawMode | int, first: int = 0) None[source]

Issue glDrawArrays with PicoGL draw-mode enums or raw gl constants.

picogl.backend.gl.wrappers.gl_draw_elements(index_count: int, dtype: int | None = GLIndexType.UNSIGNED_INT, mode: picogl.backend.gl.enums.GLDrawMode | int | None = GLDrawMode.TRIANGLES, pointer: Any | None = None, offset: int = 0) None[source]

Issue glDrawElements.

pointer may be a client index array, None (EBO bound), or omitted to use offset.

picogl.backend.gl.wrappers.gl_enable_vertex_array(location: int) Any[source]

gl_enable_vertex_array

Parameters:

location – int

picogl.backend.gl.wrappers.gl_generate_buffers(num: int = 1) Any[source]

gl_generate_buffers

Parameters:

num – int

picogl.backend.gl.wrappers.gl_generate_vertex_array(num: int = 1) Any[source]

gl_generate_vertex_array

Parameters:

num – int

picogl.backend.gl.wrappers.gl_color_array_pointer(pointer: numpy.ndarray, size: int = 4, num_type: picogl.backend.gl.enums.GLNumeric = GLNumeric.FLOAT, stride: int = 0)[source]

gl color pointer for mesh binding.

picogl.backend.gl.wrappers.gl_color_pointer_from_spec(attr: picogl.gpu.buffers.attributes.AttributeSpec)[source]

gl color pointer

picogl.backend.gl.wrappers.gl_normal_array_pointer(pointer: numpy.ndarray, stride: int = 0, num_type: picogl.backend.gl.enums.GLNumeric = GLNumeric.FLOAT)[source]

gl normal pointer for mesh binding.

picogl.backend.gl.wrappers.gl_normal_pointer_from_spec(attr: picogl.gpu.buffers.attributes.AttributeSpec)[source]

gl normal pointer

picogl.backend.gl.wrappers.gl_texcoord_array_pointer(pointer: numpy.ndarray, size: int = 2, stride: int = 0, num_type: picogl.backend.gl.enums.GLNumeric = GLNumeric.FLOAT)[source]

gl texcoord pointer for mesh binding.

picogl.backend.gl.wrappers.gl_vertex_array_pointer(pointer: numpy.ndarray | int, size: int = 3, num_type: picogl.backend.gl.enums.GLNumeric = GLNumeric.FLOAT, stride: int = 0)[source]

gl vertex pointer for mesh binding.

picogl.backend.gl.wrappers.gl_vertex_pointer_from_spec(attr: picogl.gpu.buffers.attributes.AttributeSpec)[source]

gl legacy client state

picogl.backend.gl.wrappers.gl_active_texture(unit: int) None[source]

Issue glActiveTexture.

picogl.backend.gl.wrappers.gl_bind_texture(tex_id: int, target: int = GL_TEXTURE_2D) None[source]

Issue glBindTexture.

picogl.backend.gl.wrappers.gl_compressed_tex_image(byte_array: array.array[int], gl_format: OpenGL.constant.FloatConstant | OpenGL.constant.IntConstant | OpenGL.constant.LongConstant | OpenGL.constant.StringConstant | OpenGL.constant.Constant, h: int, level: int, size: int, w: int) None[source]

Issue glCompressedTexImage2D for a 2D texture.

picogl.backend.gl.wrappers.gl_gen_textures(number: int = 1) Any[source]

Issue glGenTextures.

picogl.backend.gl.wrappers.gl_generate_mipmap(target: int = GL_TEXTURE_2D) None[source]

Generate mipmaps for the currently bound texture.

picogl.backend.gl.wrappers.gl_get_active_texture0() None[source]

Select texture unit 0.

picogl.backend.gl.wrappers.gl_tex_parameter(target: int, pname: Any, param: Any) None[source]

Issue glTexParameteri.

picogl.backend.gl.wrappers.gl_teximage2d(target: int, level: int, internalformat: OpenGL.constant.FloatConstant | OpenGL.constant.IntConstant | OpenGL.constant.LongConstant | OpenGL.constant.StringConstant | OpenGL.constant.Constant, width: int, height: int, border: int, format: OpenGL.constant.FloatConstant | OpenGL.constant.IntConstant | OpenGL.constant.LongConstant | OpenGL.constant.StringConstant | OpenGL.constant.Constant, num_type: int = GLNumeric.UNSIGNED_BYTE, data: bytes | numpy.ndarray | None = None) None[source]

Issue glTexImage2D.

picogl.backend.gl.wrappers.gl_teximage3d(target: int, level: int, internalformat: OpenGL.constant.FloatConstant | OpenGL.constant.IntConstant | OpenGL.constant.LongConstant | OpenGL.constant.StringConstant | OpenGL.constant.Constant, width: int, height: int, depth: int, border: int, format: OpenGL.constant.FloatConstant | OpenGL.constant.IntConstant | OpenGL.constant.LongConstant | OpenGL.constant.StringConstant | OpenGL.constant.Constant, num_type: int, data: bytes | numpy.ndarray | None = None) None[source]

Issue glTexImage3D.

picogl.backend.gl.wrappers.gl_bind_vertex_array(vao: int)[source]

gl_bind_vertex_array

Parameters:

vao – int VAO handle; 0 unbinds the current VAO.

picogl.backend.gl.wrappers.gl_vertex_attrib_pointer(index: int, size: int, num_type: picogl.backend.gl.enums.GLNumeric = GLNumeric.FLOAT, normalized: picogl.boolean.GLBoolean = GLBoolean.FALSE, stride: int = 0, offset: Any | None = None) None[source]

Issue glVertexAttribPointer.

offset may be a byte offset (int), None, or a ctypes.c_void_p.

picogl.backend.gl.wrappers.gl_get_integerv(val) Any[source]

get integer value