abstract class Prism::Texture
- Prism::Texture
- Reference
- Object
Overview
Represents a texture that has been loaded into OpenGL.
Direct Known Subclasses
Defined in:
prism/texture/loader.crprism/texture/texture.cr
Constructors
-
.new(id : UInt32, pool_key : String)
Creates a new texture
Class Method Summary
-
.load(file_name)
Shorthand for
#load_2d
-
.load_2d(file_name : String) : Prism::Texture2D
Loads a 2d texture
-
.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
-
.pool
Retrieves the
ReferencePool(UInt32)
pool.
Instance Method Summary
-
#bind(sampler_slot : LibGL::Int)
You must implement this method to activate the texture and bind it to the sampler slot.
- #finalize
-
#id : UInt32
Returns the texture id.
Constructor Detail
Class Method Detail
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
Retrieves the ReferencePool(UInt32)
pool.
The pool allows you to re-use UInt32
s, and will automatically manage references to each UInt32
.
See ReferencePool
for more information.
Instance Method Detail
You must implement this method to activate the texture and bind it to the sampler slot.
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.