| 1 |
{%MainUnit castleinternalglutils.pas} |
| 2 |
{ |
| 3 |
Copyright 2001-2023 Michalis Kamburelis. |
| 4 |
|
| 5 |
This file is part of "Castle Game Engine". |
| 6 |
|
| 7 |
"Castle Game Engine" is free software; see the file COPYING.txt, |
| 8 |
included in this distribution, for details about the copyright. |
| 9 |
|
| 10 |
"Castle Game Engine" is distributed in the hope that it will be useful, |
| 11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 13 |
|
| 14 |
---------------------------------------------------------------------------- |
| 15 |
} |
| 16 |
|
| 17 |
{ Part of CastleGLUtils unit: mipmaps utils. } |
| 18 |
|
| 19 |
{$ifdef read_interface} |
| 20 |
|
| 21 |
type |
| 22 |
EGenerateMipmapNotAvailable = class(Exception); |
| 23 |
|
| 24 |
{ Is GenerateMipmap call avaiable. This checks some GL extensions/versions that |
| 25 |
give us glGenerateMipmap. } |
| 26 |
function HasGenerateMipmap: boolean; |
| 27 |
|
| 28 |
{ Call glGenerateMipmap. |
| 29 |
|
| 30 |
@raises(EGenerateMipmapNotAvailable If glGenerateMipmap |
| 31 |
is available on this OpenGL version. If you don't want to get |
| 32 |
this exception, you can always check HasGenerateMipmap |
| 33 |
before calling this.) } |
| 34 |
procedure GenerateMipmap(target: TGLenum); |
| 35 |
|
| 36 |
{$endif read_interface} |
| 37 |
|
| 38 |
{$ifdef read_implementation} |
| 39 |
|
| 40 |
{ GenerateMipmap ------------------------------------------------------------- } |
| 41 |
|
| 42 |
function HasGenerateMipmap: boolean; |
| 43 |
begin |
| 44 |
Result := GLFeatures.Framebuffer; |
| 45 |
end; |
| 46 |
|
| 47 |
procedure GenerateMipmap(target: TGLenum); |
| 48 |
begin |
| 49 |
if GLFeatures.Framebuffer then |
| 50 |
begin |
| 51 |
Assert(Assigned(glGenerateMipmap)); |
| 52 |
glGenerateMipmap(Target); |
| 53 |
end else |
| 54 |
raise EGenerateMipmapNotAvailable.Create('Framebuffer not supported, glGenerateMipmap not available'); |
| 55 |
end; |
| 56 |
|
| 57 |
{$endif read_implementation} |