Encapsulates a Frame Buffer Object for offscreen rendering. When created with onscreen == true, it represents the normal framebuffer. Needed by the stack mechanism in OPENGL2 to return to onscreen rendering after a sequence of pushFramebuffer calls. It transparently handles the situations when the F
| 42 | */ |
| 43 | |
| 44 | public class FrameBuffer implements PConstants { |
| 45 | protected PGraphicsOpenGL pg; |
| 46 | protected PGL pgl; |
| 47 | protected int context; // The context that created this framebuffer. |
| 48 | |
| 49 | public int glFbo; |
| 50 | public int glDepth; |
| 51 | public int glStencil; |
| 52 | public int glDepthStencil; |
| 53 | public int glMultisample; |
| 54 | public int width; |
| 55 | public int height; |
| 56 | private GLResourceFrameBuffer glres; |
| 57 | |
| 58 | protected int depthBits; |
| 59 | protected int stencilBits; |
| 60 | protected boolean packedDepthStencil; |
| 61 | |
| 62 | protected boolean multisample; |
| 63 | protected int nsamples; |
| 64 | |
| 65 | protected int numColorBuffers; |
| 66 | protected Texture[] colorBufferTex; |
| 67 | |
| 68 | protected boolean screenFb; |
| 69 | protected boolean noDepth; |
| 70 | |
| 71 | protected IntBuffer pixelBuffer; |
| 72 | |
| 73 | |
| 74 | FrameBuffer(PGraphicsOpenGL pg) { |
| 75 | this.pg = pg; |
| 76 | pgl = pg.pgl; |
| 77 | context = pgl.createEmptyContext(); |
| 78 | } |
| 79 | |
| 80 | |
| 81 | FrameBuffer(PGraphicsOpenGL pg, int w, int h, int samples, int colorBuffers, |
| 82 | int depthBits, int stencilBits, boolean packedDepthStencil, |
| 83 | boolean screen) { |
| 84 | this(pg); |
| 85 | |
| 86 | glFbo = 0; |
| 87 | glDepth = 0; |
| 88 | glStencil = 0; |
| 89 | glDepthStencil = 0; |
| 90 | glMultisample = 0; |
| 91 | |
| 92 | if (screen) { |
| 93 | // If this framebuffer is used to represent a on-screen buffer, |
| 94 | // then it doesn't make it sense for it to have multisampling, |
| 95 | // color, depth or stencil buffers. |
| 96 | depthBits = stencilBits = samples = colorBuffers = 0; |
| 97 | } |
| 98 | |
| 99 | width = w; |
| 100 | height = h; |
| 101 |
nothing calls this directly
no outgoing calls
no test coverage detected