@@ -316,20 +316,9 @@ -(instancetype)initWithTexture:(CCTexture *)texture depthStencilFormat:(GLuint)d
316
316
glRenderbufferStorage (GL_RENDERBUFFER, depthStencilFormat, width, height);
317
317
glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, _depthRenderBuffer);
318
318
319
- // associate texture with FBO
320
- glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture.name , 0 );
321
-
322
- if (depthStencilFormat){
323
- // create and attach depth buffer
324
- glGenRenderbuffers (1 , &_depthRenderBuffer);
325
- glBindRenderbuffer (GL_RENDERBUFFER, _depthRenderBuffer);
326
- glRenderbufferStorage (GL_RENDERBUFFER, depthStencilFormat, width, height);
327
- glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, _depthRenderBuffer);
328
-
329
- // if depth format is the one with stencil part, bind same render buffer as stencil attachment
330
- if (depthStencilFormat == GL_DEPTH24_STENCIL8){
331
- glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, _depthRenderBuffer);
332
- }
319
+ // if depth format is the one with stencil part, bind same render buffer as stencil attachment
320
+ if (depthStencilFormat == GL_DEPTH24_STENCIL8){
321
+ glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, _depthRenderBuffer);
333
322
}
334
323
}
335
324
0 commit comments