0031478: Visualization, TKOpenGl - allow uploading Cubemap in compressed DDS format...
authorkgv <kgv@opencascade.com>
Fri, 15 May 2020 23:47:20 +0000 (02:47 +0300)
committerbugmaster <bugmaster@opencascade.com>
Fri, 22 May 2020 08:08:34 +0000 (11:08 +0300)
commitfaff37677c2293ad207e6ad3e308aa65ffcd6375
tree1c82a32013bb01c0fec535be92ea1e06727ef1d7
parent691711cd3e118643fc475c59d6eb83f410de5c65
0031478: Visualization, TKOpenGl - allow uploading Cubemap in compressed DDS format when supported by GPU

Graphic3d_TextureRoot::GetCompressedImage() - added new interface for fetching compressed texture image.
Default implementation detects DDS image files using Image_DDSParser parser.

Graphic3d_TextureRoot::GetImage() has been extended with new parameter
- the list of image formats supported by OpenGL driver.
Graphic3d_TextureRoot::convertToCompatible() implicitly converts
BGRA image to RGBA on OpenGL ES, which normally does not support BGR formats.

OpenGl_Caps::isTopDownTextureUV - new property defines how application defines
UV texture coordinates in primitive arrays.
OpenGl_Context::SetTextureMatrix() compares this flag with OpenGl_Texture::IsTopDown()
and automatically flips V coordinate in case of mismatch.

OpenGl_Texture now holds exact number of mipmap levels
instead of Boolean flag indicating that they are defined.
This allows loading DDS files with incomplete mipmap level set
by setting GL_TEXTURE_MAX_LEVEL to appropriate value instead of default 1000
(causing black textures in case if mipmap levels are not defined till 1x1).

Fixed order of texture coordinates transformation within GLSL program to match FFP matrix:
Rotate -> Translate -> Scale (previously Rotation was applied afterwards).
45 files changed:
samples/mfc/standard/Common/Primitive/Sample2D_Image.cpp
src/AIS/AIS_XRTrackedDevice.cxx
src/Aspect/Aspect_OpenVRSession.cxx
src/Graphic3d/Graphic3d_CubeMap.hxx
src/Graphic3d/Graphic3d_CubeMapPacked.cxx
src/Graphic3d/Graphic3d_CubeMapPacked.hxx
src/Graphic3d/Graphic3d_CubeMapSeparate.cxx
src/Graphic3d/Graphic3d_CubeMapSeparate.hxx
src/Graphic3d/Graphic3d_MediaTexture.cxx
src/Graphic3d/Graphic3d_MediaTexture.hxx
src/Graphic3d/Graphic3d_TextureParams.hxx
src/Graphic3d/Graphic3d_TextureRoot.cxx
src/Graphic3d/Graphic3d_TextureRoot.hxx
src/Image/FILES
src/Image/Image_CompressedFormat.hxx [new file with mode: 0644]
src/Image/Image_CompressedPixMap.hxx [new file with mode: 0644]
src/Image/Image_DDSParser.cxx [new file with mode: 0644]
src/Image/Image_DDSParser.hxx [new file with mode: 0644]
src/Image/Image_Format.hxx
src/Image/Image_PixMap.cxx
src/Image/Image_PixMap.hxx
src/Image/Image_SupportedFormats.cxx [new file with mode: 0644]
src/Image/Image_SupportedFormats.hxx [new file with mode: 0644]
src/Image/Image_Texture.cxx
src/Image/Image_Texture.hxx
src/OpenGl/OpenGl_Caps.cxx
src/OpenGl/OpenGl_Caps.hxx
src/OpenGl/OpenGl_Context.cxx
src/OpenGl/OpenGl_Context.hxx
src/OpenGl/OpenGl_GlFunctions.hxx
src/OpenGl/OpenGl_PrimitiveArray.cxx
src/OpenGl/OpenGl_Sampler.cxx
src/OpenGl/OpenGl_Sampler.hxx
src/OpenGl/OpenGl_ShaderManager.cxx
src/OpenGl/OpenGl_Texture.cxx
src/OpenGl/OpenGl_Texture.hxx
src/OpenGl/OpenGl_TextureFormat.cxx
src/OpenGl/OpenGl_TextureFormat.hxx
src/OpenGl/OpenGl_View.cxx
src/ViewerTest/ViewerTest_ViewerCommands.cxx
src/XCAFPrs/XCAFPrs_Texture.cxx
src/XCAFPrs/XCAFPrs_Texture.hxx
tests/v3d/glsl/cubemap_dds [new file with mode: 0644]
tests/v3d/glsl/texture_trsf2
tests/v3d/glsl/texture_trsf3 [new file with mode: 0644]