Hi,
starting writing a small rendering demo I got some results which I can’t explain! Well, I’m rendering six sides of a unit cube (each side from -0.5 to 0.5). The shaders are
char* p3DVolVert =
"void main(void) {"
" gl_Position = ftransform();"
" gl_TexCoord[0] = gl_Vertex;"
"}";
char* p3DVolFrag =
"uniform float numAdds;"
"void main(void) {"
"vec3 texCoord = gl_TexCoord[0].xyz;"
"vec3 vvec = normalize(texCoord);"
"texCoord += numAdds * vvec * -0.25;"
"if(texCoord.z < -1.0) discard;"
"if(texCoord.z > 1.0) discard;"
"if(texCoord.y < -1.0) discard;"
"if(texCoord.y > 1.0) discard;"
"if(texCoord.x < -1.0) discard;"
"if(texCoord.x > 1.0) discard;"
"gl_FragColor = vec4(texCoord+vec3(0.5), 1.0);"
"}";
The uniform numAdds is set to 7.0 and the image then looks like this:
[img]http://server2.uploadit.org/files/heliosdev-CubeHoles.JPG[/img]
The holes get smaller by decreasing numAdds and disappear (solid cube) when numAdds is 6.0.
I any of the if…discard is omitted, the hole of this plane disappears.
Any explanation is appreciated.
kon