On this page:
bitmap->texture
load-texture

23 Utility procedures for textures

These procedures can be used to load 2D texture data. Note that these, too, should only be called when an OpenGL context is active!

These procedures all load the alpha (transparancy) values as premultiplied alpha. Since this is the only form of alpha blending which leads to correct results in all cases[1], no effort has been made to support other forms of alpha blending.

If your bitmaps contain transparent values, you should therefore enable alpha blending in OpenGL as follows.
(glBlendFunc GL_ONE GL_ONE_MINUS_SRC_ALPHA)
(glEnable GL_BLEND)

Note that some (older) OpenGL implementations may restrict textures to sizes which are powers of two.

procedure

(bitmap->texture bm 
  [#:mipmap mipmap 
  #:repeat repeat-mode]) 
  exact-nonnegative->integer?
  bm : (is-a?/c bitmap%)
  mipmap : any/c = #t
  repeat-mode : (one-of/c 'none 'x 'y 'both) = 'none
Convert the bitmap into an OpenGL texture handle. As a side effect, the texture is bound to target GL_TEXTURE_2D.

The parameter mipmap (interpreted as a boolean) controls whether or not mipmapping is done. Mipmapping is a technique to avoid aliasing when an image is scaled down. If you are sure that your image will never be scaled down, you can save a small amount of memory and runtime by setting this parameter to #f.

The repeat-mode controls what happens if you use texture coordinates outside the range between 0 and 1. The parameter controls whether or not the image is repeated (tiled), and if it is repeated, it defines along which of the specified axes (x, y, or both) the image is to be repeated.

procedure

(load-texture file 
  [#:mipmap mipmap 
  #:repeat repeat-mode]) 
  exact-nonnegative->integer?
  file : (or/c path-string? input-port?)
  mipmap : any/c = #t
  repeat-mode : (one-of/c 'none 'x 'y 'both) = 'none
Load a texture directly from a named file or input port.

The parameters mipmap and repeat-mode have the same meaning as with bitmap->texture.