# OpenGL Textures

# OpenGL Textures

This extensions contains functions for loading and saving OpenGL textures using Imaging and for converting images to textures and vice versa. You need OpenGL headers for Object Pascal to be able to compile this extension. Headers from Delphi GL (dglOpenGL.pas), JEDI-SDL (gl.pas), and GLScene (OpenGL1x.pas) were tested and they work. Extension is implemented in ImagingOpenGL.pas unit located in (ImagingRoot)\Source\Extensions directory. To use it simply add this unit to uses list of your program. Currently only 2D textures are supported, DXTC/S3TC and 3Dc compressed, and floating point textures are created if supported by hardware.
Here is the table with OpenGL functions currently available. There is also Imaging OpenGL demo you can look at for inspiration Object Pascal OpenGL Demo.

## Imaging OpenGL extension functions

Loading Functions
LoadGLTextureFromFile
LoadGLTextureFromStream
LoadGLTextureFromMemory
Saving Functions
SaveGLTextureToFile
SaveGLTextureToStream
SaveGLTextureToMemory
Conversion Functions
CreateGLTextureFromImage
CreateGLTextureFromMultiImage
CreateImageFromGLTexture
CreateMultiImageFromGLTexture
Other Functions
GetGLTextureCaps
GetGLProcAddress
IsGLExtensionSupported
ImageFormatToGL

All OpenGL textures created by Imaging functions have default parameters set - that means that no glTexParameter calls are made so default filtering, wrapping, and other parameters are used. Created textures are left bound by glBindTexture when function is exited.