Revision 65e83759
Added by Leszek Koltunski over 7 years ago
src/main/java/org/distorted/library/DistortedFramebuffer.java | ||
---|---|---|
64 | 64 |
GLES30.glTexParameteri(GLES30.GL_TEXTURE_2D, GLES30.GL_TEXTURE_MAG_FILTER, GLES30.GL_NEAREST); |
65 | 65 |
|
66 | 66 |
if( mDepthStencil==DEPTH_NO_STENCIL ) |
67 |
GLES30.glTexImage2D(GLES30.GL_TEXTURE_2D, 0, GLES30.GL_DEPTH_COMPONENT, mWidth, mHeight, 0, GLES30.GL_DEPTH_COMPONENT, GLES30.GL_UNSIGNED_SHORT, null); |
|
67 |
{ |
|
68 |
GLES30.glTexImage2D(GLES30.GL_TEXTURE_2D, 0, GLES30.GL_DEPTH_COMPONENT, mWidth, mHeight, 0, GLES30.GL_DEPTH_COMPONENT, GLES30.GL_UNSIGNED_INT, null); |
|
69 |
} |
|
68 | 70 |
else if( mDepthStencil==BOTH_DEPTH_STENCIL ) |
69 |
GLES30.glTexImage2D(GLES30.GL_TEXTURE_2D, 0, GLES30.GL_DEPTH24_STENCIL8, mWidth, mHeight, 0, GLES30.GL_DEPTH_STENCIL, GLES30.GL_UNSIGNED_SHORT, null); |
|
71 |
{ |
|
72 |
GLES30.glTexImage2D(GLES30.GL_TEXTURE_2D, 0, GLES30.GL_DEPTH24_STENCIL8, mWidth, mHeight, 0, GLES30.GL_DEPTH_STENCIL, GLES30.GL_UNSIGNED_INT_24_8, null); |
|
73 |
} |
|
70 | 74 |
|
71 | 75 |
GLES30.glBindTexture(GLES30.GL_TEXTURE_2D, 0); |
72 | 76 |
GLES30.glBindFramebuffer(GLES30.GL_FRAMEBUFFER, mFBOH[0]); |
73 | 77 |
|
74 | 78 |
if( mDepthStencil==DEPTH_NO_STENCIL ) |
79 |
{ |
|
75 | 80 |
GLES30.glFramebufferTexture2D(GLES30.GL_FRAMEBUFFER, GLES30.GL_DEPTH_ATTACHMENT, GLES30.GL_TEXTURE_2D, mDepthStencilH[0], 0); |
81 |
} |
|
76 | 82 |
else if( mDepthStencil==BOTH_DEPTH_STENCIL ) |
83 |
{ |
|
77 | 84 |
GLES30.glFramebufferTexture2D(GLES30.GL_FRAMEBUFFER, GLES30.GL_DEPTH_STENCIL_ATTACHMENT, GLES30.GL_TEXTURE_2D, mDepthStencilH[0], 0); |
85 |
} |
|
78 | 86 |
|
79 | 87 |
GLES30.glBindFramebuffer(GLES30.GL_FRAMEBUFFER, 0); |
80 | 88 |
|
... | ... | |
231 | 239 |
*/ |
232 | 240 |
public void enableDepthStencil(int depthStencil) |
233 | 241 |
{ |
234 |
if( depthStencil!= NO_DEPTH_NO_STENCIL && mDepthStencilCreated==DONT_CREATE )
|
|
242 |
if( depthStencil != mDepthStencil )
|
|
235 | 243 |
{ |
236 |
mDepthStencilCreated = NOT_CREATED_YET; |
|
237 | 244 |
mDepthStencil = depthStencil; |
238 | 245 |
|
239 |
if( mBuffer1[0]!=null )
|
|
246 |
if( depthStencil!= NO_DEPTH_NO_STENCIL && mDepthStencilCreated==DONT_CREATE )
|
|
240 | 247 |
{ |
241 |
for(int i=0; i<EffectQuality.LENGTH; i++) mBuffer1[i].enableDepthStencil(depthStencil); |
|
242 |
} |
|
248 |
mDepthStencilCreated = NOT_CREATED_YET; |
|
243 | 249 |
|
244 |
markForCreation(); |
|
245 |
} |
|
246 |
if( depthStencil== NO_DEPTH_NO_STENCIL && mDepthStencilCreated!=DONT_CREATE ) |
|
247 |
{ |
|
248 |
mDepthStencilCreated = DONT_CREATE; |
|
249 |
mDepthStencil = depthStencil; |
|
250 |
if( mBuffer1[0]!=null ) |
|
251 |
for(int i=0; i<EffectQuality.LENGTH; i++) mBuffer1[i].enableDepthStencil(depthStencil); |
|
250 | 252 |
|
251 |
if( mBuffer1[0]!=null ) |
|
252 |
{ |
|
253 |
for(int i=0; i<EffectQuality.LENGTH; i++) mBuffer1[i].enableDepthStencil(depthStencil); |
|
253 |
markForCreation(); |
|
254 | 254 |
} |
255 |
if( depthStencil== NO_DEPTH_NO_STENCIL && mDepthStencilCreated!=DONT_CREATE ) |
|
256 |
{ |
|
257 |
mDepthStencilCreated = DONT_CREATE; |
|
255 | 258 |
|
256 |
markForCreation(); |
|
259 |
if( mBuffer1[0]!=null ) |
|
260 |
for(int i=0; i<EffectQuality.LENGTH; i++) mBuffer1[i].enableDepthStencil(depthStencil); |
|
261 |
|
|
262 |
markForCreation(); |
|
263 |
} |
|
257 | 264 |
} |
258 | 265 |
} |
259 | 266 |
|
Also available in: Unified diff
Fix creating FBOs with combined DEPTH/STENCIL.
This makes the Stencil app fully work, including rendering thru a FBO.