mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 05:38:31 +09:00
[Feat|Fix] (MG_Impl/Texture): Implement TexImage2D & related stuff.
This commit is contained in:
@@ -68,130 +68,154 @@ namespace MobileGL {
|
||||
}
|
||||
}
|
||||
|
||||
GLenum ConvertTextureSizedInternalFormatToGLEnum(TextureSizedInternalFormat format) {
|
||||
GLenum ConvertTextureInternalFormatToGLEnum(TextureInternalFormat format) {
|
||||
switch (format) {
|
||||
case TextureSizedInternalFormat::R8:
|
||||
case TextureInternalFormat::R8:
|
||||
return GL_R8;
|
||||
case TextureSizedInternalFormat::R8Snorm:
|
||||
case TextureInternalFormat::R8Snorm:
|
||||
return GL_R8_SNORM;
|
||||
case TextureSizedInternalFormat::R16:
|
||||
case TextureInternalFormat::R16:
|
||||
return GL_R16;
|
||||
case TextureSizedInternalFormat::R16Snorm:
|
||||
case TextureInternalFormat::R16Snorm:
|
||||
return GL_R16_SNORM;
|
||||
case TextureSizedInternalFormat::RG8:
|
||||
case TextureInternalFormat::RG8:
|
||||
return GL_RG8;
|
||||
case TextureSizedInternalFormat::RG8Snorm:
|
||||
case TextureInternalFormat::RG8Snorm:
|
||||
return GL_RG8_SNORM;
|
||||
case TextureSizedInternalFormat::RG16:
|
||||
case TextureInternalFormat::RG16:
|
||||
return GL_RG16;
|
||||
case TextureSizedInternalFormat::RG16Snorm:
|
||||
case TextureInternalFormat::RG16Snorm:
|
||||
return GL_RG16_SNORM;
|
||||
case TextureSizedInternalFormat::R3G3B2:
|
||||
case TextureInternalFormat::R3G3B2:
|
||||
return GL_R3_G3_B2;
|
||||
case TextureSizedInternalFormat::RGB4:
|
||||
case TextureInternalFormat::RGB4:
|
||||
return GL_RGB4;
|
||||
case TextureSizedInternalFormat::RGB5:
|
||||
case TextureInternalFormat::RGB5:
|
||||
return GL_RGB5;
|
||||
case TextureSizedInternalFormat::RGB8:
|
||||
case TextureInternalFormat::RGB8:
|
||||
return GL_RGB8;
|
||||
case TextureSizedInternalFormat::RGB8Snorm:
|
||||
case TextureInternalFormat::RGB8Snorm:
|
||||
return GL_RGB8_SNORM;
|
||||
case TextureSizedInternalFormat::RGB10:
|
||||
case TextureInternalFormat::RGB10:
|
||||
return GL_RGB10;
|
||||
case TextureSizedInternalFormat::RGB12:
|
||||
case TextureInternalFormat::RGB12:
|
||||
return GL_RGB12;
|
||||
case TextureSizedInternalFormat::RGB16Snorm:
|
||||
case TextureInternalFormat::RGB16Snorm:
|
||||
return GL_RGB16_SNORM;
|
||||
case TextureSizedInternalFormat::RGBA2:
|
||||
case TextureInternalFormat::RGBA2:
|
||||
return GL_RGBA2;
|
||||
case TextureSizedInternalFormat::RGBA4:
|
||||
case TextureInternalFormat::RGBA4:
|
||||
return GL_RGBA4;
|
||||
case TextureSizedInternalFormat::RGB5A1:
|
||||
case TextureInternalFormat::RGB5A1:
|
||||
return GL_RGB5_A1;
|
||||
case TextureSizedInternalFormat::RGBA8:
|
||||
case TextureInternalFormat::RGBA8:
|
||||
return GL_RGBA8;
|
||||
case TextureSizedInternalFormat::RGBA8Snorm:
|
||||
case TextureInternalFormat::RGBA8Snorm:
|
||||
return GL_RGBA8_SNORM;
|
||||
case TextureSizedInternalFormat::RGB10A2:
|
||||
case TextureInternalFormat::RGB10A2:
|
||||
return GL_RGB10_A2;
|
||||
case TextureSizedInternalFormat::RGB10A2UI:
|
||||
case TextureInternalFormat::RGB10A2UI:
|
||||
return GL_RGB10_A2UI;
|
||||
case TextureSizedInternalFormat::RGBA12:
|
||||
case TextureInternalFormat::RGBA12:
|
||||
return GL_RGBA12;
|
||||
case TextureSizedInternalFormat::RGBA16:
|
||||
case TextureInternalFormat::RGBA16:
|
||||
return GL_RGBA16;
|
||||
case TextureSizedInternalFormat::SRGB8:
|
||||
case TextureInternalFormat::SRGB8:
|
||||
return GL_SRGB8;
|
||||
case TextureSizedInternalFormat::SRGB8Alpha8:
|
||||
case TextureInternalFormat::SRGB8Alpha8:
|
||||
return GL_SRGB8_ALPHA8;
|
||||
case TextureSizedInternalFormat::R16F:
|
||||
case TextureInternalFormat::R16F:
|
||||
return GL_R16F;
|
||||
case TextureSizedInternalFormat::RG16F:
|
||||
case TextureInternalFormat::RG16F:
|
||||
return GL_RG16F;
|
||||
case TextureSizedInternalFormat::RGB16F:
|
||||
case TextureInternalFormat::RGB16F:
|
||||
return GL_RGB16F;
|
||||
case TextureSizedInternalFormat::RGBA16F:
|
||||
case TextureInternalFormat::RGBA16F:
|
||||
return GL_RGBA16F;
|
||||
case TextureSizedInternalFormat::R32F:
|
||||
case TextureInternalFormat::R32F:
|
||||
return GL_R32F;
|
||||
case TextureSizedInternalFormat::RG32F:
|
||||
case TextureInternalFormat::RG32F:
|
||||
return GL_RG32F;
|
||||
case TextureSizedInternalFormat::RGB32F:
|
||||
case TextureInternalFormat::RGB32F:
|
||||
return GL_RGB32F;
|
||||
case TextureSizedInternalFormat::RGBA32F:
|
||||
case TextureInternalFormat::RGBA32F:
|
||||
return GL_RGBA32F;
|
||||
case TextureSizedInternalFormat::R11FG11FB10F:
|
||||
case TextureInternalFormat::R11FG11FB10F:
|
||||
return GL_R11F_G11F_B10F;
|
||||
case TextureSizedInternalFormat::RGB9E5:
|
||||
case TextureInternalFormat::RGB9E5:
|
||||
return GL_RGB9_E5;
|
||||
case TextureSizedInternalFormat::R8I:
|
||||
case TextureInternalFormat::R8I:
|
||||
return GL_R8I;
|
||||
case TextureSizedInternalFormat::R8UI:
|
||||
case TextureInternalFormat::R8UI:
|
||||
return GL_R8UI;
|
||||
case TextureSizedInternalFormat::R16I:
|
||||
case TextureInternalFormat::R16I:
|
||||
return GL_R16I;
|
||||
case TextureSizedInternalFormat::R16UI:
|
||||
case TextureInternalFormat::R16UI:
|
||||
return GL_R16UI;
|
||||
case TextureSizedInternalFormat::R32I:
|
||||
case TextureInternalFormat::R32I:
|
||||
return GL_R32I;
|
||||
case TextureSizedInternalFormat::R32UI:
|
||||
case TextureInternalFormat::R32UI:
|
||||
return GL_R32UI;
|
||||
case TextureSizedInternalFormat::RG8I:
|
||||
case TextureInternalFormat::RG8I:
|
||||
return GL_RG8I;
|
||||
case TextureSizedInternalFormat::RG8UI:
|
||||
case TextureInternalFormat::RG8UI:
|
||||
return GL_RG8UI;
|
||||
case TextureSizedInternalFormat::RG16I:
|
||||
case TextureInternalFormat::RG16I:
|
||||
return GL_RG16I;
|
||||
case TextureSizedInternalFormat::RG16UI:
|
||||
case TextureInternalFormat::RG16UI:
|
||||
return GL_RG16UI;
|
||||
case TextureSizedInternalFormat::RG32I:
|
||||
case TextureInternalFormat::RG32I:
|
||||
return GL_RG32I;
|
||||
case TextureSizedInternalFormat::RG32UI:
|
||||
case TextureInternalFormat::RG32UI:
|
||||
return GL_RG32UI;
|
||||
case TextureSizedInternalFormat::RGB8I:
|
||||
case TextureInternalFormat::RGB8I:
|
||||
return GL_RGB8I;
|
||||
case TextureSizedInternalFormat::RGB8UI:
|
||||
case TextureInternalFormat::RGB8UI:
|
||||
return GL_RGB8UI;
|
||||
case TextureSizedInternalFormat::RGB16I:
|
||||
case TextureInternalFormat::RGB16I:
|
||||
return GL_RGB16I;
|
||||
case TextureSizedInternalFormat::RGB16UI:
|
||||
case TextureInternalFormat::RGB16UI:
|
||||
return GL_RGB16UI;
|
||||
case TextureSizedInternalFormat::RGB32I:
|
||||
case TextureInternalFormat::RGB32I:
|
||||
return GL_RGB32I;
|
||||
case TextureSizedInternalFormat::RGB32UI:
|
||||
case TextureInternalFormat::RGB32UI:
|
||||
return GL_RGB32UI;
|
||||
case TextureSizedInternalFormat::RGBA8I:
|
||||
case TextureInternalFormat::RGBA8I:
|
||||
return GL_RGBA8I;
|
||||
case TextureSizedInternalFormat::RGBA8UI:
|
||||
case TextureInternalFormat::RGBA8UI:
|
||||
return GL_RGBA8UI;
|
||||
case TextureSizedInternalFormat::RGBA16I:
|
||||
case TextureInternalFormat::RGBA16I:
|
||||
return GL_RGBA16I;
|
||||
case TextureSizedInternalFormat::RGBA16UI:
|
||||
case TextureInternalFormat::RGBA16UI:
|
||||
return GL_RGBA16UI;
|
||||
case TextureSizedInternalFormat::RGBA32I:
|
||||
case TextureInternalFormat::RGBA32I:
|
||||
return GL_RGBA32I;
|
||||
case TextureSizedInternalFormat::RGBA32UI:
|
||||
case TextureInternalFormat::RGBA32UI:
|
||||
return GL_RGBA32UI;
|
||||
case TextureInternalFormat::DepthComponent:
|
||||
return GL_DEPTH_COMPONENT;
|
||||
case TextureInternalFormat::DepthComponent16:
|
||||
return GL_DEPTH_COMPONENT16;
|
||||
case TextureInternalFormat::DepthComponent24:
|
||||
return GL_DEPTH_COMPONENT24;
|
||||
case TextureInternalFormat::DepthComponent32F:
|
||||
return GL_DEPTH_COMPONENT32F;
|
||||
case TextureInternalFormat::Depth24Stencil8:
|
||||
return GL_DEPTH24_STENCIL8;
|
||||
case TextureInternalFormat::Depth32FStencil8:
|
||||
return GL_DEPTH32F_STENCIL8;
|
||||
case TextureInternalFormat::DepthComponent32:
|
||||
return GL_DEPTH_COMPONENT32;
|
||||
case TextureInternalFormat::DepthStencil:
|
||||
return GL_DEPTH_STENCIL;
|
||||
case TextureInternalFormat::Red:
|
||||
return GL_RED;
|
||||
case TextureInternalFormat::RG:
|
||||
return GL_RG;
|
||||
case TextureInternalFormat::RGB:
|
||||
return GL_RGB;
|
||||
case TextureInternalFormat::RGBA:
|
||||
return GL_RGBA;
|
||||
default:
|
||||
return GL_UNKNOWN_MGL;
|
||||
}
|
||||
@@ -233,6 +257,12 @@ namespace MobileGL {
|
||||
return GL_UNSIGNED_INT_8_8_8_8_REV;
|
||||
case TexturePixelDataType::UnsignedInt1010102:
|
||||
return GL_UNSIGNED_INT_10_10_10_2;
|
||||
case TexturePixelDataType::UnsignedInt2101010Rev:
|
||||
return GL_UNSIGNED_INT_2_10_10_10_REV;
|
||||
case TexturePixelDataType::UnsignedInt101111Rev:
|
||||
return GL_UNSIGNED_INT_10F_11F_11F_REV;
|
||||
case TexturePixelDataType::UnsignedInt5999Rev:
|
||||
return GL_UNSIGNED_INT_5_9_9_9_REV;
|
||||
default:
|
||||
return GL_UNKNOWN_MGL;
|
||||
}
|
||||
@@ -266,6 +296,10 @@ namespace MobileGL {
|
||||
return GL_TEXTURE_CUBE_MAP_NEGATIVE_Z;
|
||||
case TextureUploadTarget::ProxyCubeMap:
|
||||
return GL_PROXY_TEXTURE_CUBE_MAP;
|
||||
case TextureUploadTarget::Texture2DMultisample:
|
||||
return GL_TEXTURE_2D_MULTISAMPLE;
|
||||
case TextureUploadTarget::ProxyTexture2DMultisample:
|
||||
return GL_PROXY_TEXTURE_2D_MULTISAMPLE;
|
||||
default:
|
||||
return GL_UNKNOWN_MGL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user