struct Gloop::Texture

Overview

Collection of one or more images.

See: https://www.khronos.org/opengl/wiki/Texture

Included Modules

Defined in:

gloop/texture.cr
gloop/texture/bind_target.cr
gloop/texture/compare_mode.cr
gloop/texture/depth_stencil_mode.cr
gloop/texture/mag_filter.cr
gloop/texture/min_filter.cr
gloop/texture/swizzle.cr
gloop/texture/target.cr
gloop/texture/wrap_mode.cr

Constructors

Class Method Summary

Instance Method Summary

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

def self.create(context, type : Target) : self #

Creates a new texture of the specified type.

  • OpenGL function: glCreateTextures
  • OpenGL version: 4.5

[View source]
def self.create(context, type : Symbol) : self #

Creates a new texture of the specified type.

  • OpenGL function: glCreateTextures
  • OpenGL version: 4.5

[View source]
def self.generate(context) : self #

Generates a new texture.

The texture isn't assigned a type or resources until it is bound.

See: .create

  • OpenGL function: glGenTextures
  • OpenGL version: 2.0

[View source]

Class Method Detail

def self.delete(textures : Enumerable(self)) : Nil #

Deletes multiple textures.

  • OpenGL function: glDeleteTextures
  • OpenGL version: 2.0

[View source]

Instance Method Detail

def base_level : Int32 #

Retrieves the index of the minimum mipmap level.

  • OpenGL function: glGetTextureParameteriv
  • OpenGL enum: GL_TEXTURE_BASE_LEVEL
  • OpenGL version: 4.5

[View source]
def base_level=(base_level : Int32) #

Sets the index of the minimum mipmap level.

  • OpenGL function: glTextureParameteri
  • OpenGL enum: GL_TEXTURE_BASE_LEVEL
  • OpenGL version: 4.5

[View source]
def bind(target : Target | BindTarget) : Nil #

Binds this texture to the specified target.

See: BindTarget#bind

  • OpenGL function: glBindTexture
  • OpenGL version: 2.0

[View source]
def bind(target : Symbol) : Nil #

Binds this texture to the specified target.

See: BindTarget#bind

  • OpenGL function: glBindTexture
  • OpenGL version: 2.0

[View source]
def bind(target : Target, &) : Nil #

Binds this texture to the specified target.

The previously bound texture (if any) is restored after the block completes.

See: BindTarget#bind

  • OpenGL function: glBindTexture
  • OpenGL version: 2.0

[View source]
def bind(target : BindTarget, &) #

Binds this texture to the specified target.

The previously bound texture (if any) is restored after the block completes.

See: BindTarget#bind

  • OpenGL function: glBindTexture
  • OpenGL version: 2.0

[View source]
def bind(target : Symbol, &) : Nil #

Binds this texture to the specified target.

The previously bound texture (if any) is restored after the block completes.

See: BindTarget#bind

  • OpenGL function: glBindTexture
  • OpenGL version: 2.0

[View source]
def border_color(type : Float32.class) : FloatColorTuple #

Retrieves the border color.

  • OpenGL function: glGetTextureParameterfv
  • OpenGL enum: GL_TEXTURE_BORDER_COLOR
  • OpenGL version: 4.5

[View source]
def border_color(type : Int32.class) : Int32ColorTuple #

Retrieves the border color.

  • OpenGL function: glGetTextureParameterIiv
  • OpenGL enum: GL_TEXTURE_BORDER_COLOR
  • OpenGL version: 4.5

[View source]
def border_color(type : UInt32.class) : UInt32ColorTuple #

Retrieves the border color.

  • OpenGL function: glGetTextureParameterIuiv
  • OpenGL enum: GL_TEXTURE_BORDER_COLOR
  • OpenGL version: 4.5

[View source]
def border_color : Color #

Retrieves the border color.

  • OpenGL function: glGetTextureParameterfv
  • OpenGL enum: GL_TEXTURE_BORDER_COLOR
  • OpenGL version: 4.5

[View source]
def border_color=(color : Color) #

Sets the border color.

  • OpenGL function: glTextureParameterfv
  • OpenGL enum: GL_TEXTURE_BORDER_COLOR
  • OpenGL version: 4.5

[View source]
def border_color=(color : FloatColorTuple) #

Sets the border color.

  • OpenGL function: glTextureParameterfv
  • OpenGL enum: GL_TEXTURE_BORDER_COLOR
  • OpenGL version: 4.5

[View source]
def border_color=(color : Int32ColorTuple) #

Sets the border color.

  • OpenGL function: glTextureParameterIiv
  • OpenGL enum: GL_TEXTURE_BORDER_COLOR
  • OpenGL version: 4.5

[View source]
def border_color=(color : UInt32ColorTuple) #

Sets the border color.

  • OpenGL function: glTextureParameterIuiv
  • OpenGL enum: GL_TEXTURE_BORDER_COLOR
  • OpenGL version: 4.5

[View source]
def compare_function : Gloop::DepthFunction #

Retrieves the texture comparison function.

  • OpenGL function: glGetTextureParameteriv
  • OpenGL enum: GL_TEXTURE_COMPARE_FUNC
  • OpenGL version: 4.5

[View source]
def compare_function=(compare_function : Gloop::DepthFunction) #

Sets the texture comparison function.

  • OpenGL function: glTextureParameteri
  • OpenGL enum: GL_TEXTURE_COMPARE_FUNC
  • OpenGL version: 4.5

[View source]
def compare_mode : Gloop::Texture::CompareMode #

Retrieves the texture comparison mode.

  • OpenGL function: glGetTextureParameteriv
  • OpenGL enum: GL_TEXTURE_COMPARE_MODE
  • OpenGL version: 4.5

[View source]
def compare_mode=(compare_mode : Gloop::Texture::CompareMode) #

Sets the texture comparison mode.

  • OpenGL function: glTextureParameteri
  • OpenGL enum: GL_TEXTURE_COMPARE_MODE
  • OpenGL version: 4.5

[View source]
def delete #

Deletes this texture.

  • OpenGL function: glDeleteTextures
  • OpenGL version: 2.0

[View source]
def depth_stencil_mode : Gloop::Texture::DepthStencilMode #

Retrieves the mode of operation for a texture using mixed depth and stencil data.

  • OpenGL function: glGetTextureParameteriv
  • OpenGL enum: GL_DEPTH_STENCIL_TEXTURE_MODE
  • OpenGL version: 4.5

[View source]
def depth_stencil_mode=(depth_stencil_mode : Gloop::Texture::DepthStencilMode) #

Sets the mode of operation for a texture using mixed depth and stencil data.

  • OpenGL function: glTextureParameteri
  • OpenGL enum: GL_DEPTH_STENCIL_TEXTURE_MODE
  • OpenGL version: 4.5

[View source]
def exists? #

Checks if the texture is known by OpenGL.

  • OpenGL function: glIsTexture
  • OpenGL version: 2.0

[View source]
def generate_mipmap : Nil #

Generates a mipmap for the texture.

  • OpenGL function: glGenerateTextureMipmap
  • OpenGL version: 4.5

[View source]
def lod_bias : Float32 #

Retrieves the LOD bias.

  • OpenGL function: glGetTextureParameterf
  • OpenGL enum: GL_TEXTURE_LOD_BIAS
  • OpenGL version: 4.5

[View source]
def lod_bias=(lod_bias : Float32) #

Sets the LOD bias.

  • OpenGL function: glTextureParameterf
  • OpenGL enum: GL_TEXTURE_LOD_BIAS
  • OpenGL version: 4.5

[View source]
def mag_filter : Gloop::Texture::MagFilter #

Retrieves the function that should be used when a texture is magnified.

  • OpenGL function: glGetTextureParameteriv
  • OpenGL enum: GL_TEXTURE_MAG_FILTER
  • OpenGL version: 4.5

[View source]
def mag_filter=(mag_filter : Gloop::Texture::MagFilter) #

Sets the function that should be used when a texture is magnified.

  • OpenGL function: glTextureParameteri
  • OpenGL enum: GL_TEXTURE_MAG_FILTER
  • OpenGL version: 4.5

[View source]
def max_level : Int32 #

Retrieves the maximum mipmap level.

  • OpenGL function: glGetTextureParameteriv
  • OpenGL enum: GL_TEXTURE_MAX_LEVEL
  • OpenGL version: 4.5

[View source]
def max_level=(max_level : Int32) #

Sets the maximum mipmap level.

  • OpenGL function: glTextureParameteri
  • OpenGL enum: GL_TEXTURE_MAX_LEVEL
  • OpenGL version: 4.5

[View source]
def max_lod : Float32 #

Retrieves the maximum level-of-detail.

  • OpenGL function: glGetTextureParameterf
  • OpenGL enum: GL_TEXTURE_MAX_LOD
  • OpenGL version: 4.5

[View source]
def max_lod=(max_lod : Float32) #

Sets the maximum level-of-detail.

  • OpenGL function: glTextureParameterf
  • OpenGL enum: GL_TEXTURE_MAX_LOD
  • OpenGL version: 4.5

[View source]
def min_filter : Gloop::Texture::MinFilter #

Retrieves the function that should be used when a texture is minified.

  • OpenGL function: glGetTextureParameteriv
  • OpenGL enum: GL_TEXTURE_MIN_FILTER
  • OpenGL version: 4.5

[View source]
def min_filter=(min_filter : Gloop::Texture::MinFilter) #

Sets the function that should be used when a texture is minified.

  • OpenGL function: glTextureParameteri
  • OpenGL enum: GL_TEXTURE_MIN_FILTER
  • OpenGL version: 4.5

[View source]
def min_lod : Float32 #

Retrieves the minimum level-of-detail.

  • OpenGL function: glGetTextureParameterf
  • OpenGL enum: GL_TEXTURE_MIN_LOD
  • OpenGL version: 4.5

[View source]
def min_lod=(min_lod : Float32) #

Sets the minimum level-of-detail.

  • OpenGL function: glTextureParameterf
  • OpenGL enum: GL_TEXTURE_MIN_LOD
  • OpenGL version: 4.5

[View source]
def object_type #

Indicates that this is a texture object.


[View source]
def swizzle : SwizzleRGBA #

Retrieves all component swizzle values.

Components are returned in the order: red, green, blue, alpha.

  • OpenGL function: glGetTextureParameterIiv
  • OpenGL enum: GL_TEXTURE_SWIZZLE
  • OpenGL version: 4.5

[View source]
def swizzle=(swizzle : SwizzleRGBA) #

Sets all component swizzle values.

  • OpenGL function: glTextureParameteriv
  • OpenGL enum: GL_TEXTURE_SWIZZLE
  • OpenGL version: 4.5

[View source]
def swizzle_alpha : Gloop::Texture::Swizzle #

Retrieves the alpha component swizzle.

  • OpenGL function: glGetTextureParameteriv
  • OpenGL enum: GL_TEXTURE_SWIZZLE_A
  • OpenGL version: 4.5

[View source]
def swizzle_alpha=(swizzle_alpha : Gloop::Texture::Swizzle) #

Sets the alpha component swizzle.

  • OpenGL function: glTextureParameteri
  • OpenGL enum: GL_TEXTURE_SWIZZLE_A
  • OpenGL version: 4.5

[View source]
def swizzle_blue : Gloop::Texture::Swizzle #

Retrieves the blue component swizzle.

  • OpenGL function: glGetTextureParameteriv
  • OpenGL enum: GL_TEXTURE_SWIZZLE_B
  • OpenGL version: 4.5

[View source]
def swizzle_blue=(swizzle_blue : Gloop::Texture::Swizzle) #

Sets the blue component swizzle.

  • OpenGL function: glTextureParameteri
  • OpenGL enum: GL_TEXTURE_SWIZZLE_B
  • OpenGL version: 4.5

[View source]
def swizzle_green : Gloop::Texture::Swizzle #

Retrieves the green component swizzle.

  • OpenGL function: glGetTextureParameteriv
  • OpenGL enum: GL_TEXTURE_SWIZZLE_G
  • OpenGL version: 4.5

[View source]
def swizzle_green=(swizzle_green : Gloop::Texture::Swizzle) #

Sets the green component swizzle.

  • OpenGL function: glTextureParameteri
  • OpenGL enum: GL_TEXTURE_SWIZZLE_G
  • OpenGL version: 4.5

[View source]
def swizzle_red : Gloop::Texture::Swizzle #

Retrieves the red component swizzle.

  • OpenGL function: glGetTextureParameteriv
  • OpenGL enum: GL_TEXTURE_SWIZZLE_R
  • OpenGL version: 4.5

[View source]
def swizzle_red=(swizzle_red : Gloop::Texture::Swizzle) #

Sets the red component swizzle.

  • OpenGL function: glTextureParameteri
  • OpenGL enum: GL_TEXTURE_SWIZZLE_R
  • OpenGL version: 4.5

[View source]
def target : Gloop::Texture::Target #

Retrieves the target (type) this texture is bound to.

  • OpenGL function: glGetTextureParameteriv
  • OpenGL enum: GL_TEXTURE_TARGET
  • OpenGL version: 4.5

[View source]

Retrieves the wrapping mode for the r-coordinate.

  • OpenGL function: glGetTextureParameteriv
  • OpenGL enum: GL_TEXTURE_WRAP_R
  • OpenGL version: 4.5

[View source]
def wrap_r=(wrap_r : Gloop::Texture::WrapMode) #

Sets the wrapping mode for the r-coordinate.

  • OpenGL function: glTextureParameteri
  • OpenGL enum: GL_TEXTURE_WRAP_R
  • OpenGL version: 4.5

[View source]

Retrieves the wrapping mode for the s-coordinate.

  • OpenGL function: glGetTextureParameteriv
  • OpenGL enum: GL_TEXTURE_WRAP_S
  • OpenGL version: 4.5

[View source]
def wrap_s=(wrap_s : Gloop::Texture::WrapMode) #

Sets the wrapping mode for the s-coordinate.

  • OpenGL function: glTextureParameteri
  • OpenGL enum: GL_TEXTURE_WRAP_S
  • OpenGL version: 4.5

[View source]

Retrieves the wrapping mode for the t-coordinate.

  • OpenGL function: glGetTextureParameteriv
  • OpenGL enum: GL_TEXTURE_WRAP_T
  • OpenGL version: 4.5

[View source]
def wrap_t=(wrap_t : Gloop::Texture::WrapMode) #

Sets the wrapping mode for the t-coordinate.

  • OpenGL function: glTextureParameteri
  • OpenGL enum: GL_TEXTURE_WRAP_T
  • OpenGL version: 4.5

[View source]