1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

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).
This commit is contained in:
kgv
2020-05-16 02:47:20 +03:00
committed by bugmaster
parent 691711cd3e
commit faff37677c
45 changed files with 1625 additions and 301 deletions

View File

@@ -6808,6 +6808,7 @@ static int VCaps (Draw_Interpretor& theDI,
theDI << "WinBuffer: " << (aCaps->useSystemBuffer ? "1" : "0") << "\n";
theDI << "NoExt:" << (aCaps->contextNoExtensions ? "1" : "0") << "\n";
theDI << "MaxVersion:" << aCaps->contextMajorVersionUpper << "." << aCaps->contextMinorVersionUpper << "\n";
theDI << "CompressTextures: " << (aCaps->compressedTexturesDisable ? "0" : "1") << "\n";
return 0;
}
@@ -6862,6 +6863,16 @@ static int VCaps (Draw_Interpretor& theDI,
}
aCaps->sRGBDisable = !toEnable;
}
else if (anArgCase == "-compressedtextures")
{
Standard_Boolean toEnable = Standard_True;
if (++anArgIter < theArgNb
&& !ViewerTest::ParseOnOff (theArgVec[anArgIter], toEnable))
{
--anArgIter;
}
aCaps->compressedTexturesDisable = !toEnable;
}
else if (anArgCase == "-vbo")
{
Standard_Boolean toEnable = Standard_True;
@@ -14374,7 +14385,7 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
__FILE__, VStereo, group);
theCommands.Add ("vcaps",
"vcaps [-sRGB {0|1}] [-vbo {0|1}] [-sprites {0|1}] [-ffp {0|1}] [-polygonMode {0|1}]"
"\n\t\t: [-compatibleProfile {0|1}]"
"\n\t\t: [-compatibleProfile {0|1}] [-compressedTextures {0|1}]"
"\n\t\t: [-vsync {0|1}] [-useWinBuffer {0|1}]"
"\n\t\t: [-quadBuffer {0|1}] [-stereo {0|1}]"
"\n\t\t: [-softMode {0|1}] [-noupdate|-update]"
@@ -14385,6 +14396,7 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
"\n\t\t: built-in GLSL programs"
"\n\t\t: (requires compatible profile)"
"\n\t\t: polygonMode - use Polygon Mode instead of built-in GLSL programs"
"\n\t\t: compressedTexture - allow uploading of GPU-supported compressed texture formats"
"\n\t\t: VBO - use Vertex Buffer Object (copy vertex"
"\n\t\t: arrays to GPU memory)"
"\n\t\t: sprite - use textured sprites instead of bitmaps"