abstract class Prism::Texture

Overview

Represents a texture that has been loaded into OpenGL.

Direct Known Subclasses

Defined in:

prism/texture/loader.cr
prism/texture/texture.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(id : UInt32, pool_key : String) #

Creates a new texture


[View source]

Class Method Detail

def self.load(file_name) #

Shorthand for #load_2d


[View source]
def self.load_2d(file_name : String) : Prism::Texture2D #

Loads a 2d texture


[View source]
def self.load_cube_map(texture_files : StaticArray(String, 6)) : Prism::TextureCubeMap #

Loads a cube map texture expects texture_files to be in the order of: right face, left face, top face, bottom face, back face, front face


[View source]
def self.pool #

Retrieves the ReferencePool(UInt32) pool. The pool allows you to re-use UInt32s, and will automatically manage references to each UInt32. See ReferencePool for more information.


[View source]

Instance Method Detail

abstract def bind(sampler_slot : LibGL::Int) #

You must implement this method to activate the texture and bind it to the sampler slot.


[View source]
def finalize #

[View source]
def id : UInt32 #

Returns the texture id.

TODO this is dangerous since we are pooling textures. However, we need this for now until we can update the texture abstraction.


[View source]