Revision 16d8b8f3
Added by Leszek Koltunski over 7 years ago
src/main/java/org/distorted/library/DistortedFramebuffer.java | ||
---|---|---|
55 | 55 |
mDistance = (int)(mHeight*near/(top-bottom)); |
56 | 56 |
far = 2*mDistance-near; |
57 | 57 |
|
58 |
Matrix.frustumM(mProjectionMatrix, 0, left, right, bottom, top, near, far); |
|
58 |
if( far<=0 ) |
|
59 |
{ |
|
60 |
android.util.Log.e("FBO", "error: far<=0. width="+mWidth+" height="+mHeight+ |
|
61 |
" mFOV="+mFOV+" mDistance="+mDistance+" far="+far+" near="+near); |
|
62 |
} |
|
63 |
else |
|
64 |
Matrix.frustumM(mProjectionMatrix, 0, left, right, bottom, top, near, far); |
|
59 | 65 |
} |
60 | 66 |
else // parallel projection |
61 | 67 |
{ |
... | ... | |
104 | 110 |
|
105 | 111 |
mFramebufferID = mFBORenderToTexture[0]; |
106 | 112 |
|
113 |
android.util.Log.e("FBO", "creating ("+mWidth+","+mHeight+") "+mFramebufferID); |
|
114 |
|
|
107 | 115 |
return true; |
108 | 116 |
} |
109 | 117 |
|
... | ... | |
112 | 120 |
|
113 | 121 |
private void deleteFBO() |
114 | 122 |
{ |
123 |
android.util.Log.e("FBO", "deleting ("+mWidth+","+mHeight+") "+mFramebufferID); |
|
124 |
|
|
115 | 125 |
int[] textureIds = new int[1]; |
116 | 126 |
int[] mFBORenderToTexture = new int[1]; |
117 | 127 |
|
... | ... | |
126 | 136 |
} |
127 | 137 |
|
128 | 138 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
129 |
// must be called form a thread holding OpenGL Context
|
|
139 |
// must be called from a thread holding OpenGL Context
|
|
130 | 140 |
|
131 | 141 |
void release() |
132 | 142 |
{ |
... | ... | |
152 | 162 |
|
153 | 163 |
mHeight = height; |
154 | 164 |
mWidth = width; |
155 |
mFramebufferID = 0;
|
|
165 |
mFramebufferID = -1;
|
|
156 | 166 |
mTextureID = TEXTURE_NOT_CREATED_YET; |
157 | 167 |
mFOV = 60.0f; |
158 | 168 |
mX = 0.0f; |
... | ... | |
161 | 171 |
mMarked = false; |
162 | 172 |
|
163 | 173 |
createProjection(); |
174 |
|
|
175 |
DistortedFramebufferList.add(this); |
|
164 | 176 |
} |
165 | 177 |
|
166 | 178 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
182 | 194 |
|
183 | 195 |
public void markForDeletion() |
184 | 196 |
{ |
197 |
android.util.Log.e("FBO", "marking for deletion ("+mWidth+","+mHeight+") "+mFramebufferID); |
|
198 |
|
|
185 | 199 |
DistortedFramebufferList.markForDeletion(); |
186 | 200 |
mMarked = true; |
187 | 201 |
} |
Also available in: Unified diff
DistortedFramebuffer should we working now, including deletions.