make-texture ( image -- id )


Vocabulary
opengl.textures

Inputs and outputs
imagean image
idan OpenGL texture ID


Word description
Creates a new OpenGL texture from a pixmap image whose dimensions are equal to dim.

Definition
USING: accessors kernel namespaces opengl opengl.gl
opengl.textures.private ;

IN: opengl.textures

: make-texture ( image -- id )
gen-texture [
GL_TEXTURE_BIT [
GL_TEXTURE_2D swap glBindTexture
non-power-of-2-textures? get
[ dup bitmap>> tex-image ]
[ [ f tex-image ] [ tex-sub-image ] bi ] if
] do-attribs
] keep ;