Low-level interface for OpenGL textures.
More...
#include <gpu_texture.hpp>
|
void | Create () |
| Create the texture on the GPU. More...
|
|
void | Delete () |
| Delete the texture on the GPU. More...
|
|
void | Recreate () |
| Shorthand for. More...
|
|
void | CreateFrom (uint32_t originalTextureId, InternalFormat newInternalFormat, uint32_t minMipmapLevel, uint32_t mipmapLevels) |
| Create the texture on the GPU from the given immutable texture. More...
|
|
void | CreateFrom (GpuTexture originalGpuTexture, InternalFormat newInternalFormat, uint32_t minMipmapLevel, uint32_t mipmapLevels) |
| Create the texture on the GPU from the given immutable texture. More...
|
|
void | SetStorage (InternalFormat internalFormat, Vector2i size, int32_t mipmapLevels=1) const |
| Initialize the immutable data storage on the GPU. More...
|
|
void | SetSubData (Vector2i offset, Vector2i size, Format dataFormat, DataType dataType, const void *data, int32_t mipmapLevel=0) const |
| Set a portion of the texture data. More...
|
|
void | SetData (InternalFormat internalFormat, Vector2i size, Format dataFormat, DataType dataType, const void *data, int32_t mipmapLevel=0) const |
| Initialize and set the initial texture data. More...
|
|
void | GenerateMipmap () const |
|
void | SetDebugName (std::string_view name) const |
| Adds a friendly debug name for this GpuTexture. This is used when debugging graphics in external applications such as Nsight or RenderDoc. This function does nothing if the application isn't compiled in Debug. More...
|
|
bool_t | GetImmutable () const |
| Get whether the GpuTexture data is immutable. More...
|
|
MagnificationFilter | GetMinFilter () const |
|
void | SetMinFilter (MagnificationFilter newMinFilter) const |
|
MagnificationFilter | GetMagFilter () const |
|
void | SetMagFilter (MagnificationFilter newMagFilter) const |
|
Wrapping | GetWrappingHorizontal () const |
|
void | SetWrappingHorizontal (Wrapping newWrappingHorizontal) const |
|
Wrapping | GetWrappingVertical () const |
|
void | SetWrappingVertical (Wrapping newWrappingVertical) const |
|
Color | GetBorderColor () const |
|
void | SetBorderColor (Color newBorderColor) const |
|
uint32_t | GetId () const |
|
| operator uint32_t () const |
|
Low-level interface for OpenGL textures.
Definition at line 12 of file gpu_texture.hpp.
◆ Create()
void Mountain::Graphics::GpuTexture::Create |
( |
| ) |
|
◆ CreateFrom() [1/2]
void Mountain::Graphics::GpuTexture::CreateFrom |
( |
uint32_t |
originalTextureId, |
|
|
InternalFormat |
newInternalFormat, |
|
|
uint32_t |
minMipmapLevel, |
|
|
uint32_t |
mipmapLevels |
|
) |
| |
Create the texture on the GPU from the given immutable texture.
- Parameters
-
originalTextureId | The texture ID whose data is to be what this texture will view |
newInternalFormat | The internal format for the newly created texture. This format must be compatible with the original texture format as per this table. |
minMipmapLevel | The starting mipmap level in the original texture to view |
mipmapLevels | The number of mipmap levels of the original texture to view |
This creates a new texture that is a view of the given original texture.
- See also
- glGenTextures() glTextureView()
- Note
- The original texture must be immutable
◆ CreateFrom() [2/2]
void Mountain::Graphics::GpuTexture::CreateFrom |
( |
GpuTexture |
originalGpuTexture, |
|
|
InternalFormat |
newInternalFormat, |
|
|
uint32_t |
minMipmapLevel, |
|
|
uint32_t |
mipmapLevels |
|
) |
| |
Create the texture on the GPU from the given immutable texture.
- Parameters
-
originalGpuTexture | The texture whose data is to be what this texture will view |
newInternalFormat | The internal format for the newly created texture. This format must be compatible with the original texture format as per this table. |
minMipmapLevel | The starting mipmap level in the original texture to view |
mipmapLevels | The number of mipmap levels of the original texture to view |
This creates a new texture that is a view of the given original texture.
- See also
- glGenTextures() glTextureView()
- Note
- The original texture must be immutable
◆ Delete()
void Mountain::Graphics::GpuTexture::Delete |
( |
| ) |
|
◆ GenerateMipmap()
void Mountain::Graphics::GpuTexture::GenerateMipmap |
( |
| ) |
const |
◆ GetBorderColor()
Color Mountain::Graphics::GpuTexture::GetBorderColor |
( |
| ) |
const |
◆ GetImmutable()
bool_t Mountain::Graphics::GpuTexture::GetImmutable |
( |
| ) |
const |
◆ GetMagFilter()
MagnificationFilter Mountain::Graphics::GpuTexture::GetMagFilter |
( |
| ) |
const |
◆ GetMinFilter()
MagnificationFilter Mountain::Graphics::GpuTexture::GetMinFilter |
( |
| ) |
const |
◆ GetWrappingHorizontal()
Wrapping Mountain::Graphics::GpuTexture::GetWrappingHorizontal |
( |
| ) |
const |
◆ GetWrappingVertical()
Wrapping Mountain::Graphics::GpuTexture::GetWrappingVertical |
( |
| ) |
const |
◆ Recreate()
void Mountain::Graphics::GpuTexture::Recreate |
( |
| ) |
|
◆ SetBorderColor()
void Mountain::Graphics::GpuTexture::SetBorderColor |
( |
Color |
newBorderColor | ) |
const |
◆ SetData()
void Mountain::Graphics::GpuTexture::SetData |
( |
InternalFormat |
internalFormat, |
|
|
Vector2i |
size, |
|
|
Format |
dataFormat, |
|
|
DataType |
dataType, |
|
|
const void * |
data, |
|
|
int32_t |
mipmapLevel = 0 |
|
) |
| const |
Initialize and set the initial texture data.
- Parameters
-
internalFormat | The format to use to store the data on the GPU |
size | The size of the texture |
dataFormat | The format of the given data |
dataType | The type of the given data |
data | The data to set |
mipmapLevel | The mipmap level to set |
- Note
- This will fail if the texture data is immutable, e.g. a call to
SetStorage()
was already made. If you want to use this function and the texture data is immutable, you first need to Recreate()
the texture.
- See also
- glTexImage2D()
◆ SetDebugName()
void Mountain::Graphics::GpuTexture::SetDebugName |
( |
std::string_view |
name | ) |
const |
Adds a friendly debug name for this GpuTexture. This is used when debugging graphics in external applications such as Nsight or RenderDoc. This function does nothing if the application isn't compiled in Debug.
- Parameters
-
- See also
- glObjectLabel()
◆ SetMagFilter()
void Mountain::Graphics::GpuTexture::SetMagFilter |
( |
MagnificationFilter |
newMagFilter | ) |
const |
◆ SetMinFilter()
void Mountain::Graphics::GpuTexture::SetMinFilter |
( |
MagnificationFilter |
newMinFilter | ) |
const |
◆ SetStorage()
void Mountain::Graphics::GpuTexture::SetStorage |
( |
InternalFormat |
internalFormat, |
|
|
Vector2i |
size, |
|
|
int32_t |
mipmapLevels = 1 |
|
) |
| const |
Initialize the immutable data storage on the GPU.
- Parameters
-
mipmapLevels | The number of mipmap levels to initialize |
internalFormat | The format to use to store the data on the GPU |
size | The size of the texture |
- Note
- This will fail if the texture data is already immutable, e.g. a call to
SetStorage()
was already made. If you want to use this function again, you first need to Recreate()
the texture.
- See also
- glTexStorage2D()
◆ SetSubData()
void Mountain::Graphics::GpuTexture::SetSubData |
( |
Vector2i |
offset, |
|
|
Vector2i |
size, |
|
|
Format |
dataFormat, |
|
|
DataType |
dataType, |
|
|
const void * |
data, |
|
|
int32_t |
mipmapLevel = 0 |
|
) |
| const |
Set a portion of the texture data.
- Parameters
-
offset | The offset from in the texture to set the data from |
size | The size of the data the set |
dataFormat | The format of the given data |
dataType | The type of the given format |
data | The data to set |
mipmapLevel | The mipmap level to set |
- See also
- glTexSubImage2D()
◆ SetWrappingHorizontal()
void Mountain::Graphics::GpuTexture::SetWrappingHorizontal |
( |
Wrapping |
newWrappingHorizontal | ) |
const |
◆ SetWrappingVertical()
void Mountain::Graphics::GpuTexture::SetWrappingVertical |
( |
Wrapping |
newWrappingVertical | ) |
const |
The documentation for this struct was generated from the following file: