This class wraps an OpenGL texture. By Andres Colubri
| 42 | * |
| 43 | */ |
| 44 | public class Texture implements PConstants { |
| 45 | /** |
| 46 | * Texture with normalized UV. |
| 47 | */ |
| 48 | protected static final int TEX2D = 0; |
| 49 | /** |
| 50 | * Texture with un-normalized UV. |
| 51 | */ |
| 52 | protected static final int TEXRECT = 1; |
| 53 | |
| 54 | /** Point sampling: both magnification and minification filtering are set |
| 55 | * to nearest */ |
| 56 | protected static final int POINT = 2; |
| 57 | /** Linear sampling: magnification filtering is nearest, minification set |
| 58 | * to linear */ |
| 59 | protected static final int LINEAR = 3; |
| 60 | /** Bilinear sampling: both magnification filtering is set to linear and |
| 61 | * minification either to linear-mipmap-nearest (linear interpolation is used |
| 62 | * within a mipmap, but not between different mipmaps). */ |
| 63 | protected static final int BILINEAR = 4; |
| 64 | /** Trilinear sampling: magnification filtering set to linear, minification to |
| 65 | * linear-mipmap-linear, which offers the best mipmap quality since linear |
| 66 | * interpolation to compute the value in each of two maps and then |
| 67 | * interpolates linearly between these two values. */ |
| 68 | protected static final int TRILINEAR = 5; |
| 69 | |
| 70 | |
| 71 | // This constant controls how many times pixelBuffer and rgbaPixels can be |
| 72 | // accessed before they are not released anymore. The idea is that if they |
| 73 | // have been used only a few times, it doesn't make sense to keep them around. |
| 74 | protected static final int MAX_UPDATES = 10; |
| 75 | |
| 76 | // The minimum amount of free JVM's memory (in MB) before pixelBuffer and |
| 77 | // rgbaPixels are released every time after they are used. |
| 78 | protected static final int MIN_MEMORY = 5; |
| 79 | |
| 80 | public int width, height; |
| 81 | |
| 82 | public int glName; |
| 83 | public int glTarget; |
| 84 | public int glFormat; |
| 85 | public int glMinFilter; |
| 86 | public int glMagFilter; |
| 87 | public int glWrapS; |
| 88 | public int glWrapT; |
| 89 | public int glWidth; |
| 90 | public int glHeight; |
| 91 | private GLResourceTexture glres; |
| 92 | |
| 93 | protected PGraphicsOpenGL pg; |
| 94 | protected PGL pgl; // The interface between Processing and OpenGL. |
| 95 | protected int context; // The context that created this texture. |
| 96 | protected boolean colorBuffer; // true if it is the color attachment of |
| 97 | // FrameBuffer object. |
| 98 | |
| 99 | protected boolean usingMipmaps; |
| 100 | protected boolean usingRepeat; |
| 101 | protected float maxTexcoordU; |
nothing calls this directly
no outgoing calls
no test coverage detected