summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/support/glrenderer/ExtTexture.java
blob: 121e17d5faeed37493201b497814fde58f6ff1dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package com.android.camera.support.glrenderer;


//ExtTexture is a texture whose content comes from a external texture.
//Before drawing, setSize() should be called.
public class ExtTexture extends BasicTexture {

 private int mTarget;

 public ExtTexture(GLCanvas canvas, int target) {
     GLId glId = canvas.getGLId();
     mId = glId.generateTexture();
     mTarget = target;
 }

 private void uploadToCanvas(GLCanvas canvas) {
     canvas.setTextureParameters(this);
     setAssociatedCanvas(canvas);
     mState = STATE_LOADED;
 }

 @Override
 protected boolean onBind(GLCanvas canvas) {
     if (!isLoaded()) {
         uploadToCanvas(canvas);
     }

     return true;
 }

 @Override
 public int getTarget() {
     return mTarget;
 }

 @Override
 public boolean isOpaque() {
     return true;
 }

 @Override
 public void yield() {
     // we cannot free the texture because we have no backup.
 }
}