Castle Game EngineIntroduction Units Class Hierarchy Classes, Interfaces, Objects and Records Types Variables Constants Functions and Procedures Identifiers |
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 URL: 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); deprecated; |
Warning: this symbol is deprecated.
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 WindowPos determines where the left-bottom corner of the image will be placed. Right now, WindowPos corresponds to an OpenGL raster position expressed in window coordinates, although you should not depend on it in new programs (the idea of raster disappears in new OpenGL versions).
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. For older OpenGL versions, this can be affected by glPixelZoom (for newer versions, we will provide new methods to choose a part of the image and/or scale it in the future).
You should only use this inside TUIControl.Draw when TUIControl.DrawStyle returns ds2D. This means that we require that current projection is 2D and lighting / depth test and such are off. For engine <= 4.1.0, the above is not really a strict requirement, normal 3D transformations have no effect over how the image is drawn. But for new engine versions, it will become required.
|
Properties
 |
property Width: Cardinal read FWidth; |
|
 |
property Height: Cardinal read FHeight; |
|
Generated by PasDoc 0.13.0 on 2013-08-17 21:27:12
|