1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-09 18:50:54 +03:00
occt/tests/v3d/glsl/texture_trsf2
kgv faff37677c 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).
2020-05-22 11:08:34 +03:00

43 lines
1.1 KiB
Plaintext

puts "========"
puts "Texture 2D transformation (presentation trsf)"
puts "========"
set aTexture [locate_data_file bug26122_texture_trsf_ref.png]
pload MODELING VISUALIZATION
box b 1 1 1
explode b F
for { set aPass 0 } { $aPass < 2 } { incr aPass } {
vclear
vclose ALL
set aSuffix ""
if { $aPass == 0 } {
set aSuffix "ffp"
vcaps -ffp 1
} else {
set aSuffix "glsl"
vcaps -ffp 0
}
vinit View1 w=512 h=512
vtop
vdisplay -dispMode 1 b_6
vfit
vtexture b_6 $aTexture -modulate off
vdump $::imagedir/${::casename}_identity_${aSuffix}.png
vtexture b_6 $aTexture -trsfTranslate 0.0 0.0 -trsfScale 0.8 2.0 -trsfAngle 0
vdump $::imagedir/${::casename}_scale_${aSuffix}.png
vtexture b_6 $aTexture -trsfTranslate 0.25 -0.25 -trsfScale 1.0 1.0 -trsfAngle 0
vdump $::imagedir/${::casename}_translate_${aSuffix}.png
vtexture b_6 $aTexture -trsfTranslate 0.0 0.1 -trsfScale 1 1.1 -trsfAngle 30
vdump $::imagedir/${::casename}_rotate_${aSuffix}.png
vtexture b_6 $aTexture -trsfTranslate 0.25 -0.25 -trsfScale 1.1 0.8 -trsfAngle 0
vdump $::imagedir/${::casename}_${aSuffix}.png
}