()
| 428 | |
| 429 | |
| 430 | protected void initDepthBuffer() { |
| 431 | if (screenFb) return; |
| 432 | |
| 433 | if (width == 0 || height == 0) { |
| 434 | throw new RuntimeException("PFramebuffer: size undefined."); |
| 435 | } |
| 436 | |
| 437 | pg.pushFramebuffer(); |
| 438 | pg.setFramebuffer(this); |
| 439 | |
| 440 | pgl.bindRenderbuffer(PGL.RENDERBUFFER, glDepth); |
| 441 | |
| 442 | int glConst = PGL.DEPTH_COMPONENT16; |
| 443 | if (depthBits == 16) { |
| 444 | glConst = PGL.DEPTH_COMPONENT16; |
| 445 | } else if (depthBits == 24) { |
| 446 | glConst = PGL.DEPTH_COMPONENT24; |
| 447 | } else if (depthBits == 32) { |
| 448 | glConst = PGL.DEPTH_COMPONENT32; |
| 449 | } |
| 450 | |
| 451 | if (multisample) { |
| 452 | pgl.renderbufferStorageMultisample(PGL.RENDERBUFFER, nsamples, glConst, |
| 453 | width, height); |
| 454 | } else { |
| 455 | pgl.renderbufferStorage(PGL.RENDERBUFFER, glConst, width, height); |
| 456 | } |
| 457 | |
| 458 | pgl.framebufferRenderbuffer(PGL.FRAMEBUFFER, PGL.DEPTH_ATTACHMENT, |
| 459 | PGL.RENDERBUFFER, glDepth); |
| 460 | |
| 461 | pg.popFramebuffer(); |
| 462 | } |
| 463 | |
| 464 | |
| 465 | protected void initStencilBuffer() { |
no test coverage detected