32 mOpenGLRenderer{aOpenGLRenderer}, mTexture{&aTexture}
34 glGenTextures ( 1, &mTextureId );
35 OPENGL_CHECK_ERROR_THROW;
37 if ( glIsTexture ( mTextureId ) )
40 glGetTextureLevelParameteriv ( mTextureId, 0, GL_TEXTURE_WIDTH, &w );
41 glGetTextureLevelParameteriv ( mTextureId, 0, GL_TEXTURE_HEIGHT, &h );
42 if ( aTexture.
GetWidth() ==
static_cast<uint32_t
> ( w ) && aTexture.
GetHeight() ==
static_cast<uint32_t
> ( h ) )
44 glTextureSubImage2D ( mTextureId, 0, 0, 0, aTexture.
GetWidth(), aTexture.
GetHeight(),
52 glBindTexture ( GL_TEXTURE_2D, mTextureId );
53 OPENGL_CHECK_ERROR_THROW;
54 glTexImage2D ( GL_TEXTURE_2D,
63 OPENGL_CHECK_ERROR_THROW;
64 glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
65 OPENGL_CHECK_ERROR_THROW;
66 glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
67 OPENGL_CHECK_ERROR_THROW;
68 glBindTexture ( GL_TEXTURE_2D, 0 );
69 OPENGL_CHECK_ERROR_THROW;
OpenGLTexture(OpenGLRenderer &aOpenGLRenderer, const Texture &aTexture)
GLuint GetTextureId() const
Get the OpenGL texture object identifier.
Represents a 2D texture image resource.
DLL uint32_t GetWidth() const
Returns the texture width in pixels.
DLL Format GetFormat() const
Returns the pixel format.
DLL const std::vector< uint8_t > & GetPixels() const
Returns a reference to the raw pixel data.
@ UNSIGNED_SHORT
16-bit unsigned integer per channel.
@ UNSIGNED_BYTE
8-bit unsigned integer per channel.
@ BGRA
4-channel blue, green, red, alpha.
@ RGB
3-channel red, green, blue.
DLL Type GetType() const
Returns the pixel component type.
DLL uint32_t GetHeight() const
Returns the texture height in pixels.