Class TGLImage
Unit
CastleGLImages
Declaration
type TGLImage = class(TObject)
Description
OpenGL image ready to be drawn on 2D screen.
Hierarchy
Overview
Methods
Properties
 |
property Width: Cardinal read FWidth; |
 |
property Height: Cardinal read FHeight; |
Description
Methods
 |
constructor Create(const FileName: string; const LoadAsClass: array of TCastleImageClass; const ResizeToX: Cardinal = 0; const ResizeToY: Cardinal = 0; const Interpolation: TResizeInterpolation = riNearest); |
Load image from disk, and prepare for drawing.
Parameters
- LoadAsClass
- Force a specific image class to load. Must be a subset of PixelsImageClasses, as other classes cannot be loaded into OpenGL 2D images, otherwise you may get EImageClassNotSupportedForOpenGL exception. Pass empty set [] to load into any allowed class (it's equivalent to passing LoadAsClass = PixelsImageClasses).
You can pass e.g. [TRGBImage] to force loading into an RGB image without an alpha channel (it will be stripped from the image if necessary).
- Forbidden
- convertions to do when loading, see CastleImages.LoadImage. Pass empty set [] to not forbid anything.
- ResizeToX
- After loading, resize to given width. Pass 0 to not resize width.
- ResizeToY
- After loading, resize to given height. Pass 0 to not resize height.
- Interpolation
- If any resizing will be needed (if ResizeToX / ResizeToY parameters request some specific size, and it is different than loaded image size) then the resize operation will use given interpolation.
Exceptions raised
- EImageClassNotSupportedForOpenGL
- When image class is not supported by OpenGL.
|
 |
constructor CreatePart( const Image: TCastleImage; const X0, Y0, AWidth, AHeight: Cardinal); |
Prepare part of the image for drawing.
Exceptions raised
- EImageClassNotSupportedForOpenGL
- When Image class is not supported by OpenGL.
|
 |
destructor Destroy; override; |
|
 |
procedure Draw; |
Draw the image as 2D on screen.
The current OpenGL raster position determines where the left-bottom corner of the image will be placed. Usually it's most comfortable to set the raster in window coordinates by CastleGLUtils.SetWindowPos. You can also set it using OpenGL glRasterPos2i or similar commands (in which case raster is transformed by OpenGL projection and modelview matrices and affected by current OpenGL viewport, so be sure they are Ok).
The image is drawn in 2D, which means that in normal circumstances 1 pixel of the image is just placed over 1 pixel of the screen. This can be affected by glPixelZoom. Normal 3D transformations have no effect over how the image is drawn.
|
Properties
 |
property Width: Cardinal read FWidth; |
|
 |
property Height: Cardinal read FHeight; |
|
Generated by PasDoc 0.12.1 on 2013-02-04 20:26:50
|