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

Method initTex2DShader

core/src/processing/opengl/PGL.java:1286–1318  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1284
1285
1286 protected PGL initTex2DShader() {
1287 PGL ppgl = primaryPGL ? this : graphics.getPrimaryPGL();
1288
1289 if (!ppgl.loadedTex2DShader || ppgl.tex2DShaderContext != ppgl.glContext) {
1290 String[] preprocVertSrc = preprocessVertexSource(texVertShaderSource, getGLSLVersion(), getGLSLVersionSuffix());
1291 String vertSource = PApplet.join(preprocVertSrc, "\n");
1292 String[] preprocFragSrc = preprocessFragmentSource(tex2DFragShaderSource, getGLSLVersion(), getGLSLVersionSuffix());
1293 String fragSource = PApplet.join(preprocFragSrc, "\n");
1294 ppgl.tex2DVertShader = createShader(VERTEX_SHADER, vertSource);
1295 ppgl.tex2DFragShader = createShader(FRAGMENT_SHADER, fragSource);
1296 if (0 < ppgl.tex2DVertShader && 0 < ppgl.tex2DFragShader) {
1297 ppgl.tex2DShaderProgram = createProgram(ppgl.tex2DVertShader, ppgl.tex2DFragShader);
1298 }
1299 if (0 < ppgl.tex2DShaderProgram) {
1300 ppgl.tex2DVertLoc = getAttribLocation(ppgl.tex2DShaderProgram, "position");
1301 ppgl.tex2DTCoordLoc = getAttribLocation(ppgl.tex2DShaderProgram, "texCoord");
1302 ppgl.tex2DSamplerLoc = getUniformLocation(ppgl.tex2DShaderProgram, "texMap");
1303 }
1304 ppgl.loadedTex2DShader = true;
1305 ppgl.tex2DShaderContext = ppgl.glContext;
1306
1307 genBuffers(1, intBuffer);
1308 ppgl.tex2DGeoVBO = intBuffer.get(0);
1309 bindBuffer(ARRAY_BUFFER, ppgl.tex2DGeoVBO);
1310 bufferData(ARRAY_BUFFER, 16 * SIZEOF_FLOAT, null, STATIC_DRAW);
1311 }
1312
1313 if (texData == null) {
1314 texData = allocateDirectFloatBuffer(texCoords.length);
1315 }
1316
1317 return ppgl;
1318 }
1319
1320
1321 protected void drawTexture2D(int id, int texW, int texH,

Callers 1

drawTexture2DMethod · 0.95

Calls 15

getGLSLVersionMethod · 0.95
getGLSLVersionSuffixMethod · 0.95
joinMethod · 0.95
createShaderMethod · 0.95
createProgramMethod · 0.95
getAttribLocationMethod · 0.95
getUniformLocationMethod · 0.95
genBuffersMethod · 0.95
bindBufferMethod · 0.95
bufferDataMethod · 0.95

Tested by

no test coverage detected