0031682: Visualization - Prs3d_ShadingAspect::SetTransparency() has no effect with...
[occt.git] / tests / v3d / glsl / geom1
CommitLineData
8e0a2b19 1puts "========"
2puts "0029074: Visualization, TKOpenGl - support Geometry Shader definition"
3puts "========"
4
5pload MODELING VISUALIZATION
6
7set aShaderVert "
8out vec4 VertColor;
9void main() {
10 VertColor = occColor;
11 gl_Position = occVertex;
12}"
13
14# define a Geometry shader drawing shrinked triangles
15set aShaderGeom "
16layout(triangles) in;
17layout(triangle_strip, max_vertices=3) out;
18in vec4 VertColor\[3\];
19out vec4 Color;
20void main() {
21 mat4 aMat = occProjectionMatrix * occWorldViewMatrix * occModelWorldMatrix;
22 vec3 aCenter = vec3 (0.0, 0.0, 0.0);
23 for (int aTriVertIter = 0; aTriVertIter < 3; ++aTriVertIter) {
24 aCenter += gl_in\[aTriVertIter\].gl_Position.xyz;
25 }
26 aCenter /= 3.0;
27 for (int aTriVertIter = 0; aTriVertIter < 3; ++aTriVertIter) {
28 vec3 aVec = gl_in\[aTriVertIter\].gl_Position.xyz - aCenter;
29 vec3 aVertRes = aCenter + normalize (aVec) * length (aVec) * 0.75;
30 gl_Position = aMat * vec4 (aVertRes, 1.0);
31 Color = VertColor\[aTriVertIter\] * 2.0;
32 EmitVertex();
33 }
34 EndPrimitive();
35}"
36
37set aShaderFrag "
38in vec4 Color;
39void main() {
40 occFragColor = Color;
41}"
42
43# draw a box
44box b 1 2 3
45vcaps -core
46vclear
47vinit View1
48vaxo
49vdisplay -dispMode 1 -mutable b
50vfit
51vrotate 0.2 0.0 0.0
52vdump $::imagedir/${::casename}_normal.png
53
54vshaderprog b -vert $aShaderVert -geom $aShaderGeom -frag $aShaderFrag
55vdump $::imagedir/${::casename}_geom.png