Revision b448e6b9
Added by Leszek Koltunski almost 9 years ago
| src/main/java/org/distorted/library/DistortedRenderTarget.java | ||
|---|---|---|
| 28 | 28 |
{
|
| 29 | 29 |
private static final int TEXTURE_FAILED_TO_CREATE = -1; |
| 30 | 30 |
private static final int TEXTURE_NOT_CREATED_YET = -2; |
| 31 |
private static final int TEXTURE_DONT_CREATE = -3; |
|
| 31 | 32 |
|
| 32 | 33 |
private int mFramebufferID, mTextureID; |
| 33 | 34 |
private float mX, mY; |
| ... | ... | |
| 131 | 132 |
|
| 132 | 133 |
mHeight = height; |
| 133 | 134 |
mWidth = width; |
| 134 |
mFramebufferID = 0;
|
|
| 135 |
mFramebufferID = -1;
|
|
| 135 | 136 |
mTextureID = TEXTURE_NOT_CREATED_YET; |
| 136 |
mFOV = 6.0f; |
|
| 137 |
mFOV = 60.0f;
|
|
| 137 | 138 |
mX = 0.0f; |
| 138 | 139 |
mY = 0.0f; |
| 139 | 140 |
|
| 140 | 141 |
createProjection(); |
| 141 | 142 |
} |
| 142 | 143 |
|
| 144 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 145 |
|
|
| 146 |
public DistortedRenderTarget(int fbo) |
|
| 147 |
{
|
|
| 148 |
mProjectionMatrix = new float[16]; |
|
| 149 |
|
|
| 150 |
mFramebufferID = fbo; |
|
| 151 |
mTextureID = TEXTURE_DONT_CREATE; |
|
| 152 |
mFOV = 60.0f; |
|
| 153 |
mX = 0.0f; |
|
| 154 |
mY = 0.0f; |
|
| 155 |
} |
|
| 156 |
|
|
| 143 | 157 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 144 | 158 |
|
| 145 | 159 |
public void release() |
| 146 | 160 |
{
|
| 147 | 161 |
if( mTextureID>=0 ) deleteFBO(); |
| 162 |
|
|
| 163 |
mProjectionMatrix = null; |
|
| 148 | 164 |
} |
| 149 | 165 |
|
| 150 | 166 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| ... | ... | |
| 177 | 193 |
return mFramebufferID; |
| 178 | 194 |
} |
| 179 | 195 |
|
| 180 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 181 |
|
|
| 182 |
public int getTexture() |
|
| 183 |
{
|
|
| 184 |
return mTextureID; |
|
| 185 |
} |
|
| 186 |
|
|
| 187 | 196 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 188 | 197 |
// set this as Render Target. Must be called from a thread holding OpenGL context. |
| 189 | 198 |
|
| ... | ... | |
| 191 | 200 |
{
|
| 192 | 201 |
if( mTextureID==TEXTURE_NOT_CREATED_YET ) createFBO(); |
| 193 | 202 |
|
| 194 |
|
|
| 203 |
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, mFramebufferID); |
|
| 195 | 204 |
} |
| 196 | 205 |
} |
Also available in: Unified diff
Minor progress with RenderTarget