I have reimplemented OpenCSG for modern OpenGL version.
PixelFormatAttributes:
NSOpenGLPFAColorSize , 24 ,
NSOpenGLPFAAlphaSize , 8 ,
NSOpenGLPFADepthSize , 32 ,
NSOpenGLPFAStencilSize , 8 ,
NSOpenGLPFAAccelerated ,
NSOpenGLPFADoubleBuffer ,
NSOpenGLPFASupersample ,
NSOpenGLPFASampleBuffers, 1 ,
NSOpenGLPFASamples , 4 ,
FBO specs: (tried render to FBO with multisample, but lines getting more strong and visible, look on screenshot at bottom)
- created texture with power of 2, GL_RGBA (tried GL_RGBA8 and GL_RGBA32F)
- GL_DEPTH24_STENCIL8 (tried GL_DEPTH32_STENCIL8, no result)
Simply algorithm Goldfeather:
while (i < depth complexity) {
take channel for render
merge layers if no free channel
render each layer with stencil func, mask and depth params to channel (FBO)
}
merge layers (taking texture from FBO and render objects again with applying shader below)
In shader I have code for merging (result texture from FBO overlaps on top of rendering for testing, in OpenCSG it's setupProjectiveTexture):
vec2 ndcPos = gl_FragCoord.xy / sizetexture.xy;
vec4 maskColor = texture2D(maskTexture, ndcPos.xy);
if (maskColor[channel] < 0.5) {
discard;
}
Looks like after FBO getting not enough clear texture or not right size.
EDIT:
Those lines appears only in overlapping places of subtracting mesh.
EDIT 2:
Fixed with rendering to non MSAA FBO and applying FXAA on result.
Supersample
in your pixel format you are asking GL for SSAA instead of MSAA. This is OS X; I have never encountered a hardware accelerated pixel format on OS X that supports supersampling, only the software renderer. I would suggest you remove that from your pixel format too. At this point this is getting pretty nit-picky, but since the only information in the question right now is related to your pixel format... :) – Machucadiscard
you write something like this:gl_FragDepth = 1.0f; gl_FragColor = vec4 (0.0f, 0.0f, 0.0f, 0.0f); return;
? I have a wild hunch, but without the code to try it myself the best I can do is ask you if it changes anything. – Machuca