MCPcopy Index your code
hub / github.com/processing/processing / allocate

Method allocate

core/src/processing/opengl/Texture.java:1135–1172  ·  view source on GitHub ↗

Allocates the opengl texture object.

()

Source from the content-addressed store, hash-verified

1133 * Allocates the opengl texture object.
1134 */
1135 protected void allocate() {
1136 dispose(); // Just in the case this object is being re-allocated.
1137
1138 boolean enabledTex = false;
1139 if (!pgl.texturingIsEnabled(glTarget)) {
1140 pgl.enableTexturing(glTarget);
1141 enabledTex = true;
1142 }
1143
1144 context = pgl.getCurrentContext();
1145 glres = new GLResourceTexture(this);
1146
1147 pgl.bindTexture(glTarget, glName);
1148 pgl.texParameteri(glTarget, PGL.TEXTURE_MIN_FILTER, glMinFilter);
1149 pgl.texParameteri(glTarget, PGL.TEXTURE_MAG_FILTER, glMagFilter);
1150 pgl.texParameteri(glTarget, PGL.TEXTURE_WRAP_S, glWrapS);
1151 pgl.texParameteri(glTarget, PGL.TEXTURE_WRAP_T, glWrapT);
1152 if (PGraphicsOpenGL.anisoSamplingSupported) {
1153 pgl.texParameterf(glTarget, PGL.TEXTURE_MAX_ANISOTROPY,
1154 PGraphicsOpenGL.maxAnisoAmount);
1155 }
1156
1157 // First, we use glTexImage2D to set the full size of the texture (glW/glH
1158 // might be diff from w/h in the case that the GPU doesn't support NPOT
1159 // textures)
1160 pgl.texImage2D(glTarget, 0, glFormat, glWidth, glHeight, 0,
1161 PGL.RGBA, PGL.UNSIGNED_BYTE, null);
1162
1163 // Makes sure that the texture buffer in video memory doesn't contain
1164 // any garbage.
1165 pgl.initTexture(glTarget, PGL.RGBA, width, height);
1166
1167 pgl.bindTexture(glTarget, 0);
1168 if (enabledTex) {
1169 pgl.disableTexturing(glTarget);
1170 }
1171 bound = false;
1172 }
1173
1174
1175 /**

Callers 14

initMethod · 0.95
getColorValueMethod · 0.45
getDepthValueMethod · 0.45
getStencilValueMethod · 0.45
allocateByteBufferMethod · 0.45
updateByteBufferMethod · 0.45
allocateShortBufferMethod · 0.45
updateShortBufferMethod · 0.45
allocateIntBufferMethod · 0.45
updateIntBufferMethod · 0.45
allocateFloatBufferMethod · 0.45
updateFloatBufferMethod · 0.45

Calls 10

disposeMethod · 0.95
texturingIsEnabledMethod · 0.80
getCurrentContextMethod · 0.80
bindTextureMethod · 0.80
enableTexturingMethod · 0.45
texParameteriMethod · 0.45
texParameterfMethod · 0.45
texImage2DMethod · 0.45
initTextureMethod · 0.45
disableTexturingMethod · 0.45

Tested by

no test coverage detected