mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-18 14:27:39 +03:00
0028912: Visualization, TKOpenGl - multi-texture support
Graphic3d_AspectFillArea3d now stores array of textures. Graphic3d_TextureParams stores texture unit for mapping texture. OpenGl_Context::BindTextures() - context now manages the set of active textures. Related code has been removed from OpenGl_Workspace. OpenGl_Sampler has been extended to hold texture parameters structure. OpenGl_Texture now holds OpenGl_Sampler instance as class field. OpenGl_Texture inherits new class OpenGl_NamedResource and holds texture identifier used for sharing resource in OpenGl_Context. OpenGl_RaytraceGeometry now creates bindless textures taking Sampler object directly from OpenGl_Texture. OpenGl_Context::BindTextures() automatically recreates immutable Sampler Object on texture parameters change. Declared new structure OpenGl_ArbSamplerObject for platform-neutral usage of related functionality. Related functions are now loaded within OpenGL ES 3.0+. Declarations.glsl - occActiveSampler has been renamed to occSampler0 with aliases occSamplerBaseColor (main) and occActiveSampler (for compatibility). Additional texture samplers should be declared explicitly within specific GLSL program as occSampler1, occSampler2, etc. AIS_Shape and AIS_ColoredShape now computes Shaded presentation with UV coordinates if texture mapping is enabled in Drawer. vshaderprog now accepts Shader source code as parameter.
This commit is contained in:
40
tests/v3d/glsl/texture_multi1
Normal file
40
tests/v3d/glsl/texture_multi1
Normal file
@@ -0,0 +1,40 @@
|
||||
puts "========"
|
||||
puts "0028912: Visualization, TKOpenGl - multi-texture support"
|
||||
puts "========"
|
||||
|
||||
pload MODELING VISUALIZATION
|
||||
|
||||
set aShaderVert "
|
||||
THE_SHADER_OUT vec2 TexCoord;
|
||||
void main() {
|
||||
TexCoord = occTexCoord.st;
|
||||
gl_Position = occProjectionMatrix * occWorldViewMatrix * occModelWorldMatrix * occVertex;
|
||||
}"
|
||||
|
||||
set aShaderFrag "
|
||||
uniform sampler2D occSampler1;
|
||||
uniform sampler2D occSampler2;
|
||||
uniform sampler2D occSampler3;
|
||||
THE_SHADER_IN vec2 TexCoord;
|
||||
void main() {
|
||||
if (TexCoord.s < 0.5 && TexCoord.t < 0.5) { occFragColor = occTexture2D(occSampler0, TexCoord.st); }
|
||||
else if (TexCoord.s < 0.5 && TexCoord.t >= 0.5) { occFragColor = occTexture2D(occSampler1, TexCoord.st); }
|
||||
else if (TexCoord.s >= 0.5 && TexCoord.t < 0.5) { occFragColor = occTexture2D(occSampler2, TexCoord.st); }
|
||||
else { occFragColor = occTexture2D(occSampler3, TexCoord.st); }
|
||||
}"
|
||||
|
||||
# draw a box
|
||||
box b 1 2 3
|
||||
vclear
|
||||
vinit View1
|
||||
vaxo
|
||||
vdisplay -dispMode 1 b
|
||||
vfit
|
||||
vrotate 0.2 0.0 0.0
|
||||
|
||||
# take snapshot with built-in shader
|
||||
vtexture b -tex0 3 -tex1 4 -tex2 5 -tex3 6
|
||||
vdump $::imagedir/${::casename}_normal.png
|
||||
|
||||
vshaderprog b $aShaderVert $aShaderFrag
|
||||
vdump $::imagedir/${::casename}_multi.png
|
Reference in New Issue
Block a user