Revision baa3989b
Added by Leszek Koltunski almost 6 years ago
src/main/java/org/distorted/library/main/DistortedFramebuffer.java | ||
---|---|---|
39 | 39 |
if( mColorCreated==NOT_CREATED_YET ) |
40 | 40 |
{ |
41 | 41 |
GLES31.glGenTextures( mNumColors, mColorH, 0); |
42 |
GLES31.glGenFramebuffers(1, mFBOH, 0); |
|
43 |
GLES31.glBindFramebuffer(GLES31.GL_FRAMEBUFFER, mFBOH[0]); |
|
42 | 44 |
|
43 | 45 |
for(int i=0; i<mNumColors; i++) |
44 | 46 |
{ |
... | ... | |
49 | 51 |
GLES31.glTexParameterf(GLES31.GL_TEXTURE_2D, GLES31.GL_TEXTURE_MAG_FILTER, GLES31.GL_LINEAR); |
50 | 52 |
GLES31.glTexImage2D(GLES31.GL_TEXTURE_2D, 0, GLES31.GL_RGBA, mRealWidth, mRealHeight, 0, GLES31.GL_RGBA, GLES31.GL_UNSIGNED_BYTE, null); |
51 | 53 |
} |
52 |
GLES31.glBindTexture(GLES31.GL_TEXTURE_2D, 0); |
|
53 |
|
|
54 |
GLES31.glGenFramebuffers(1, mFBOH, 0); |
|
55 |
GLES31.glBindFramebuffer(GLES31.GL_FRAMEBUFFER, mFBOH[0]); |
|
56 | 54 |
GLES31.glFramebufferTexture2D(GLES31.GL_FRAMEBUFFER, GLES31.GL_COLOR_ATTACHMENT0, GLES31.GL_TEXTURE_2D, mColorH[0], 0); |
55 |
GLES31.glBindTexture(GLES31.GL_TEXTURE_2D, 0); |
|
57 | 56 |
GLES31.glBindFramebuffer(GLES31.GL_FRAMEBUFFER, 0); |
58 | 57 |
|
59 | 58 |
mColorCreated = checkStatus("color"); |
... | ... | |
78 | 77 |
} |
79 | 78 |
|
80 | 79 |
GLES31.glBindTexture(GLES31.GL_TEXTURE_2D, 0); |
81 |
|
|
82 | 80 |
GLES31.glBindFramebuffer(GLES31.GL_FRAMEBUFFER, mFBOH[0]); |
83 | 81 |
|
84 | 82 |
if( mDepthStencil==DEPTH_NO_STENCIL ) |
... | ... | |
107 | 105 |
GLES31.glDeleteTextures(1, mDepthStencilH, 0); |
108 | 106 |
mDepthStencilH[0]=0; |
109 | 107 |
} |
110 |
if( mDepthStencilCreated==COPIED && mDepthStencilH[0]>0 ) |
|
111 |
{ |
|
112 |
mDepthStencilCreated = DONT_CREATE; |
|
113 |
mDepthStencilH[0]=0; |
|
114 |
} |
|
115 | 108 |
} |
116 | 109 |
|
117 | 110 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
135 | 128 |
return CREATED; |
136 | 129 |
} |
137 | 130 |
|
138 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
139 |
// the Framebuffer was created without DEPTH or STENCIL but now we want to copy it from some other. |
|
140 |
// Framebuffer 'from' MUST be already created!! |
|
141 |
// Must be called from a thread holding OpenGL Context |
|
142 |
// |
|
143 |
// 'Private' , library-only function used only for the postprocessing buffers! |
|
144 |
|
|
145 |
void copyDepthAndStencil(DistortedFramebuffer from) |
|
146 |
{ |
|
147 |
mDepthStencilCreated = COPIED; |
|
148 |
mDepthStencilH[0] = from.mDepthStencilH[0]; |
|
149 |
} |
|
150 |
|
|
151 | 131 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
152 | 132 |
// Must be called from a thread holding OpenGL Context |
153 | 133 |
|
Also available in: Unified diff
Revert last changes to the postprocessing FBO.
This reverts commit 2dbed690bdbee80d9bfb22c800073855eb5d0946.